From 4c16431a6793b6d272c275efe2d2f5fda200bdd8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 28 Nov 2011 16:56:38 +0000 Subject: [PATCH] Handle more cases in APInt::getLowBitsSet's fast path. llvm-svn: 145249 --- llvm/include/llvm/ADT/APInt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 707e0dbb6b91..78119bce2ac4 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -497,8 +497,8 @@ public: if (loBitsSet == APINT_BITS_PER_WORD) return APInt(numBits, -1ULL); // For small values, return quickly. - if (numBits < APINT_BITS_PER_WORD) - return APInt(numBits, (1ULL << loBitsSet) - 1); + if (loBitsSet <= APINT_BITS_PER_WORD) + return APInt(numBits, -1ULL >> (APINT_BITS_PER_WORD - loBitsSet)); return getAllOnesValue(numBits).lshr(numBits - loBitsSet); }