]> granicus.if.org Git - llvm/commitdiff
[APInt] Use ugt(uint64_t) for the compare in getLimitedValue(uint64_t) since the...
authorCraig Topper <craig.topper@gmail.com>
Wed, 19 Apr 2017 23:52:59 +0000 (23:52 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 19 Apr 2017 23:52:59 +0000 (23:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300796 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APInt.h

index cdcb178c97feabaefd9c9d642091a6b41c246440..e517a13af1efde4c24550d821004b8b770542b79 100644 (file)
@@ -426,8 +426,7 @@ public:
   /// If this value is smaller than the specified limit, return it, otherwise
   /// return the limit value.  This causes the value to saturate to the limit.
   uint64_t getLimitedValue(uint64_t Limit = UINT64_MAX) const {
-    return (getActiveBits() > 64 || getZExtValue() > Limit) ? Limit
-                                                            : getZExtValue();
+    return ugt(Limit) ? Limit : getZExtValue();
   }
 
   /// \brief Check if the APInt consists of a repeated bit pattern.