[llvm] r299293 - [APInt] Implement operator! using operator==(uint64_t). NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 23:50:00 PDT 2017


Author: ctopper
Date: Sat Apr  1 01:50:00 2017
New Revision: 299293

URL: http://llvm.org/viewvc/llvm-project?rev=299293&view=rev
Log:
[APInt] Implement operator! using operator==(uint64_t). NFCI

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=299293&r1=299292&r2=299293&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Sat Apr  1 01:50:00 2017
@@ -627,13 +627,7 @@ public:
   ///
   /// \returns true if *this is zero, false otherwise.
   bool operator!() const {
-    if (isSingleWord())
-      return !VAL;
-
-    for (unsigned i = 0; i != getNumWords(); ++i)
-      if (pVal[i])
-        return false;
-    return true;
+    return *this == 0;
   }
 
   /// @}




More information about the llvm-commits mailing list