From f89ea5068ff385d298a576c399a459f909f6dda0 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Mon, 19 Mar 2007 05:22:18 +0000 Subject: [PATCH] Add isStrictPositive() to APInt to determine if this APInt Value > 0. llvm-svn: 35156 --- llvm/include/llvm/ADT/APInt.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 3d479da4b834..f609f61e1381 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/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;