[llvm-commits] [llvm] r110991 - /llvm/trunk/include/llvm/ADT/APInt.h

Benjamin Kramer benny.kra at googlemail.com
Thu Aug 12 17:29:44 PDT 2010


Author: d0k
Date: Thu Aug 12 19:29:44 2010
New Revision: 110991

URL: http://llvm.org/viewvc/llvm-project?rev=110991&view=rev
Log:
Use getAllOnesValue, saves a copy and looks better.

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=110991&r1=110990&r2=110991&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Thu Aug 12 19:29:44 2010
@@ -464,7 +464,7 @@
     // For small values, return quickly
     if (numBits <= APINT_BITS_PER_WORD)
       return APInt(numBits, ~0ULL << shiftAmt);
-    return (~APInt(numBits, 0)).shl(shiftAmt);
+    return getAllOnesValue(numBits).shl(shiftAmt);
   }
 
   /// Constructs an APInt value that has the bottom loBitsSet bits set.
@@ -481,7 +481,7 @@
     // For small values, return quickly.
     if (numBits < APINT_BITS_PER_WORD)
       return APInt(numBits, (1ULL << loBitsSet) - 1);
-    return (~APInt(numBits, 0)).lshr(numBits - loBitsSet);
+    return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
   }
 
   /// The hash value is computed as the sum of the words and the bit width.





More information about the llvm-commits mailing list