aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-03 00:24:39 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-03 00:24:39 +0000
commit239e4021ce2dc1e57f31190b9e9737d0f2c507c1 (patch)
treed310f91da6d5d423e9872103d5d621d63155bc95
parentbee0f663d842f5aa41286c22815446e2d22de95a (diff)
downloadexternal_llvm-239e4021ce2dc1e57f31190b9e9737d0f2c507c1.zip
external_llvm-239e4021ce2dc1e57f31190b9e9737d0f2c507c1.tar.gz
external_llvm-239e4021ce2dc1e57f31190b9e9737d0f2c507c1.tar.bz2
Add isPositive for symmetry with isNegative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34862 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/APInt.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 07e22fc..aec9e56 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -106,7 +106,7 @@ class APInt {
/// @returns a uint64_t type integer with just bit position at
/// "whichBit(bitPosition)" setting, others zero.
static inline uint64_t maskBit(uint32_t bitPosition) {
- return (static_cast<uint64_t>(1)) << whichBit(bitPosition);
+ return 1ULL << whichBit(bitPosition);
}
/// This method is used internally to clear the to "N" bits that are not used
@@ -365,6 +365,13 @@ public:
return (*this)[BitWidth - 1];
}
+ /// This just tests the high bit of the APInt to determine if the value is
+ /// positove or not.
+ /// @brief Determine if this APInt Value is positive.
+ bool isPositive() const {
+ return !isNegative();
+ }
+
/// Arithmetic right-shift this APInt by shiftAmt.
/// @brief Arithmetic right-shift function.
APInt ashr(uint32_t shiftAmt) const;