diff options
author | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-19 05:22:18 +0000 |
---|---|---|
committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-19 05:22:18 +0000 |
commit | fdcd5a7740f5947a8679524f71852d36e79766a0 (patch) | |
tree | 0798e60ef0e3de092158f4b78e9368aa57a32ccb | |
parent | 79b098445b93e551dba79aeb9584ee24be0d3dae (diff) |
Add isStrictPositive() to APInt to determine if this APInt Value > 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35156 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/APInt.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 3d479da4b8..f609f61e13 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -374,6 +374,12 @@ public: return !isNegative(); } + /// This just tests if the value of this APInt is strictly positive (> 0). + /// @brief Determine if this APInt Value is strictly positive. + inline bool isStrictPositive() const { + return isPositive() && (*this) != 0; + } + /// Arithmetic right-shift this APInt by shiftAmt. /// @brief Arithmetic right-shift function. APInt ashr(uint32_t shiftAmt) const; |