1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Add an isSignedIntN, like isIntN but for signed integer values instead of

unsigned.

llvm-svn: 46894
This commit is contained in:
Dan Gohman 2008-02-08 21:58:15 +00:00
parent 90f03a0b88
commit 3d296e049c

View File

@ -280,7 +280,7 @@ public:
isNegative() && countPopulation() == 1;
}
/// @brief Check if this APInt has an N-bits integer value.
/// @brief Check if this APInt has an N-bits unsigned integer value.
inline bool isIntN(uint32_t N) const {
assert(N && "N == 0 ???");
if (isSingleWord()) {
@ -291,6 +291,12 @@ public:
}
}
/// @brief Check if this APInt has an N-bits signed integer value.
inline bool isSignedIntN(uint32_t N) const {
assert(N && "N == 0 ???");
return getMinSignedBits() <= N;
}
/// @returns true if the argument APInt value is a power of two > 0.
bool isPowerOf2() const;
@ -1221,11 +1227,16 @@ inline APInt umax(const APInt &A, const APInt &B) {
return A.ugt(B) ? A : B;
}
/// @brief Check if the specified APInt has a N-bits integer value.
/// @brief Check if the specified APInt has a N-bits unsigned integer value.
inline bool isIntN(uint32_t N, const APInt& APIVal) {
return APIVal.isIntN(N);
}
/// @brief Check if the specified APInt has a N-bits signed integer value.
inline bool isSignedIntN(uint32_t N, const APInt& APIVal) {
return APIVal.isSignedIntN(N);
}
/// @returns true if the argument APInt value is a sequence of ones
/// starting at the least significant bit with the remainder zero.
inline bool isMask(uint32_t numBits, const APInt& APIVal) {