summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-10-16 06:04:27 +0000
committerOwen Anderson <resistor@mac.com>2012-10-16 06:04:27 +0000
commite3f7be36c75ddcafb24b52c36c55c3dc17215db3 (patch)
treeb80d57738343f6617c7e69f80089beb6bd3ff4b7 /include
parentfdc054c3a393cff235a499edaa714f94f6b35d0f (diff)
Fix a bug in the set(I,E)/reset(I,E) methods that I recently added. The boundary condition for checking if I and E were in the same word were incorrect, and, beyond that, the mask computation was not using a wide enough constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/BitVector.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index 4523828d454..9d6388f7ee6 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -244,9 +244,9 @@ public:
if (I == E) return *this;
- if (I / BITWORD_SIZE == (E-1) / BITWORD_SIZE) {
- BitWord EMask = 1 << (E % BITWORD_SIZE);
- BitWord IMask = 1 << (I % BITWORD_SIZE);
+ if (I / BITWORD_SIZE == E / BITWORD_SIZE) {
+ BitWord EMask = 1UL << (E % BITWORD_SIZE);
+ BitWord IMask = 1UL << (I % BITWORD_SIZE);
BitWord Mask = EMask - IMask;
Bits[I / BITWORD_SIZE] |= Mask;
return *this;
@@ -282,9 +282,9 @@ public:
if (I == E) return *this;
- if (I / BITWORD_SIZE == (E-1) / BITWORD_SIZE) {
- BitWord EMask = 1 << (E % BITWORD_SIZE);
- BitWord IMask = 1 << (I % BITWORD_SIZE);
+ if (I / BITWORD_SIZE == E / BITWORD_SIZE) {
+ BitWord EMask = 1UL << (E % BITWORD_SIZE);
+ BitWord IMask = 1UL << (I % BITWORD_SIZE);
BitWord Mask = EMask - IMask;
Bits[I / BITWORD_SIZE] &= ~Mask;
return *this;