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

Dan Gohman gohman at apple.com
Mon Feb 11 15:45:15 PST 2008


Author: djg
Date: Mon Feb 11 17:45:14 2008
New Revision: 46978

URL: http://llvm.org/viewvc/llvm-project?rev=46978&view=rev
Log:
Correct the order of the arguments in the examples in the comments
for APInt::getBitsSet. And fix an off-by-one bug in "wrapping" mode.

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=46978&r1=46977&r2=46978&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Mon Feb 11 17:45:14 2008
@@ -371,9 +371,9 @@
 
   /// Constructs an APInt value that has a contiguous range of bits set. The
   /// bits from loBit to hiBit will be set. All other bits will be zero. For
-  /// example, with parameters(32, 15, 0) you would get 0x0000FFFF. If hiBit is
+  /// example, with parameters(32, 0, 15) you would get 0x0000FFFF. If hiBit is
   /// less than loBit then the set bits "wrap". For example, with 
-  /// parameters (32, 3, 28), you would get 0xF000000F. 
+  /// parameters (32, 28, 3), you would get 0xF000000F. 
   /// @param numBits the intended bit width of the result
   /// @param loBit the index of the lowest bit set.
   /// @param hiBit the index of the highest bit set.
@@ -384,7 +384,7 @@
     assert(loBit < numBits && "loBit out of range");
     if (hiBit < loBit)
       return getLowBitsSet(numBits, hiBit+1) |
-             getHighBitsSet(numBits, numBits-loBit+1);
+             getHighBitsSet(numBits, numBits-loBit);
     return getLowBitsSet(numBits, hiBit-loBit+1).shl(loBit);
   }
 





More information about the llvm-commits mailing list