14 #ifndef LLVM_CLANG_AST_CHARUNITS_H
15 #define LLVM_CLANG_AST_CHARUNITS_H
17 #include "llvm/ADT/DenseMapInfo.h"
18 #include "llvm/Support/DataTypes.h"
19 #include "llvm/Support/MathExtras.h"
69 Quantity += Other.Quantity;
80 Quantity -= Other.Quantity;
93 return Quantity == Other.Quantity;
96 return Quantity != Other.Quantity;
101 return Quantity < Other.Quantity;
104 return Quantity <= Other.Quantity;
107 return Quantity > Other.Quantity;
110 return Quantity >= Other.Quantity;
116 bool isZero()
const {
return Quantity == 0; }
119 bool isOne()
const {
return Quantity == 1; }
130 return (Quantity & -Quantity) == Quantity;
138 return (*
this % N) == 0;
157 return Quantity / Other.Quantity;
163 return Quantity % Other.Quantity;
166 return CharUnits(Quantity + Other.Quantity);
169 return CharUnits(Quantity - Other.Quantity);
185 return CharUnits(llvm::alignTo(Quantity, Align.Quantity));
191 assert(Quantity != 0 &&
"offsetting from unknown alignment?");
192 return CharUnits(llvm::MinAlign(Quantity, offset.Quantity));
242 static const bool value =
true;
247 #endif // LLVM_CLANG_AST_CHARUNITS_H
bool isNegative() const
isNegative - Test whether the quantity is less than zero.
bool isOne() const
isOne - Test whether the quantity equals one.
static clang::CharUnits getTombstoneKey()
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
bool isPowerOfTwo() const
isPowerOfTwo - Test whether the quantity is a power of two.
CharUnits alignTo(const CharUnits &Align) const
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is ...
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
bool operator==(const CharUnits &Other) const
CharUnits & operator*=(QuantityType N)
bool operator!=(const CharUnits &Other) const
CharUnits - This is an opaque type for sizes expressed in character units.
CharUnits operator%(QuantityType N) const
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
static bool isEqual(const clang::CharUnits &LHS, const clang::CharUnits &RHS)
static CharUnits One()
One - Construct a CharUnits quantity of one.
CharUnits & operator+=(const CharUnits &Other)
static clang::CharUnits getEmptyKey()
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
CharUnits operator-() const
CharUnits()
CharUnits - A default constructor.
bool isMultipleOf(CharUnits N) const
Test whether this is a multiple of the other value.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
CharUnits operator/(QuantityType N) const
bool operator<(const CharUnits &Other) const
CharUnits operator*(QuantityType N) const
bool isZero() const
isZero - Test whether the quantity equals zero.
CharUnits & operator-=(const CharUnits &Other)
bool operator>(const CharUnits &Other) const
bool operator<=(const CharUnits &Other) const
CharUnits operator+(const CharUnits &Other) const
CharUnits & operator/=(QuantityType N)
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset...
static unsigned getHashValue(const clang::CharUnits &CU)
bool operator>=(const CharUnits &Other) const