[llvm-commits] [llvm] r166031 - /llvm/trunk/include/llvm/ADT/SmallBitVector.h
Owen Anderson
resistor at mac.com
Tue Oct 16 10:10:33 PDT 2012
Author: resistor
Date: Tue Oct 16 12:10:33 2012
New Revision: 166031
URL: http://llvm.org/viewvc/llvm-project?rev=166031&view=rev
Log:
Speculative fix the mask constants to be of type uintptr_t. I don't know of any case where the old form was incorrect, but I'm more confident that such cases don't exist in this version.
Modified:
llvm/trunk/include/llvm/ADT/SmallBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallBitVector.h?rev=166031&r1=166030&r2=166031&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallBitVector.h Tue Oct 16 12:10:33 2012
@@ -306,8 +306,8 @@
assert(E <= size() && "Attempted to set out-of-bounds range!");
if (I == E) return *this;
if (isSmall()) {
- uintptr_t EMask = 1 << E;
- uintptr_t IMask = 1 << I;
+ uintptr_t EMask = ((uintptr_t)1) << E;
+ uintptr_t IMask = ((uintptr_t)1) << I;
uintptr_t Mask = EMask - IMask;
setSmallBits(getSmallBits() | Mask);
} else
@@ -337,8 +337,8 @@
assert(E <= size() && "Attempted to reset out-of-bounds range!");
if (I == E) return *this;
if (isSmall()) {
- uintptr_t EMask = 1 << E;
- uintptr_t IMask = 1 << I;
+ uintptr_t EMask = ((uintptr_t)1) << E;
+ uintptr_t IMask = ((uintptr_t)1) << I;
uintptr_t Mask = EMask - IMask;
setSmallBits(getSmallBits() & ~Mask);
} else
More information about the llvm-commits
mailing list