Changes in directory llvm/include/llvm/ADT:
APInt.h updated: 1.55 -> 1.56 --- Log message: Actually, for getHighBitsSet and getLowBitsSet, don't make a 0 bit size illegal. Instead do the 0 valued construction for the user. This is because the caller may not know (or care to check) that the number of bits set is zero. --- Diffs of the changes: (+6 -2) APInt.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.55 llvm/include/llvm/ADT/APInt.h:1.56 --- llvm/include/llvm/ADT/APInt.h:1.55 Sat Mar 24 18:47:58 2007 +++ llvm/include/llvm/ADT/APInt.h Sat Mar 24 19:01:47 2007 @@ -355,7 +355,9 @@ /// @brief Get a value with high bits set static APInt getHighBitsSet(uint32_t numBits, uint32_t hiBitsSet) { assert(hiBitsSet <= numBits && "Too many bits to set!"); - assert(hiBitsSet > 0 && "You must set SOME bits"); + // Handle a degenerate case, to avoid shifting by word size + if (hiBitsSet == 0) + return APInt(numBits, 0); uint32_t shiftAmt = numBits - hiBitsSet; // For small values, return quickly if (numBits <= APINT_BITS_PER_WORD) @@ -369,7 +371,9 @@ /// @brief Get a value with low bits set static APInt getLowBitsSet(uint32_t numBits, uint32_t loBitsSet) { assert(loBitsSet <= numBits && "Too many bits to set!"); - assert(loBitsSet > 0 && "You must set SOME bits"); + // Handle a degenerate case, to avoid shifting by word size + if (loBitsSet == 0) + return APInt(numBits, 0); uint32_t shiftAmt = numBits - loBitsSet; // For small values, return quickly if (numBits <= APINT_BITS_PER_WORD) _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits