mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
Implement inline methods that make transition of ConstantInt to use APInt
easier to comprehend and might be useful elsewhere. llvm-svn: 34635
This commit is contained in:
parent
728cf2d5cf
commit
11f19f730c
@ -463,12 +463,12 @@ public:
|
||||
/// if isSign == true, it should be largest signed value, otherwise largest
|
||||
/// unsigned value.
|
||||
/// @brief Gets max value of the APInt with bitwidth <= 64.
|
||||
static APInt getMaxValue(uint32_t numBits, bool isSign);
|
||||
static APInt getMaxValue(uint32_t numBits, bool isSigned);
|
||||
|
||||
/// @returns the smallest value for an APInt of the given bit-width and
|
||||
/// if isSign == true, it should be smallest signed value, otherwise zero.
|
||||
/// @brief Gets min value of the APInt with bitwidth <= 64.
|
||||
static APInt getMinValue(uint32_t numBits, bool isSign);
|
||||
static APInt getMinValue(uint32_t numBits, bool isSigned);
|
||||
|
||||
/// @returns the all-ones value for an APInt of the specified bit-width.
|
||||
/// @brief Get the all-ones value.
|
||||
@ -484,6 +484,42 @@ public:
|
||||
return countLeadingZeros() != BitWidth;
|
||||
}
|
||||
|
||||
/// This checks to see if the value has all bits of the APInt are set or not.
|
||||
/// @brief Determine if all bits are set
|
||||
inline bool isAllOnesValue() const {
|
||||
return countPopulation() == BitWidth;
|
||||
}
|
||||
|
||||
/// This checks to see if the value of this APInt is the maximum unsigned
|
||||
/// value for the APInt's bit width.
|
||||
/// @brief Determine if this is the largest unsigned value.
|
||||
bool isMaxValue() const {
|
||||
return countPopulation() == BitWidth;
|
||||
}
|
||||
|
||||
/// This checks to see if the value of this APInt is the maximum signed
|
||||
/// value for the APInt's bit width.
|
||||
/// @brief Determine if this is the largest signed value.
|
||||
bool isMaxSignedValue() const {
|
||||
return BitWidth == 1 ? VAL == 0 :
|
||||
!isNegative() && countPopulation() == BitWidth - 1;
|
||||
}
|
||||
|
||||
/// This checks to see if the value of this APInt is the minimum signed
|
||||
/// value for the APInt's bit width.
|
||||
/// @brief Determine if this is the smallest unsigned value.
|
||||
bool isMinValue() const {
|
||||
return countPopulation() == 0;
|
||||
}
|
||||
|
||||
/// This checks to see if the value of this APInt is the minimum signed
|
||||
/// value for the APInt's bit width.
|
||||
/// @brief Determine if this is the smallest signed value.
|
||||
bool isMinSignedValue() const {
|
||||
return BitWidth == 1 ? VAL == 1 :
|
||||
isNegative() && countPopulation() == 1;
|
||||
}
|
||||
|
||||
/// @returns a character interpretation of the APInt.
|
||||
std::string toString(uint8_t radix = 10, bool wantSigned = true) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user