diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h index fba1d12542a1..a9cd54e13b38 100644 --- a/include/llvm/ADT/SmallBitVector.h +++ b/include/llvm/ADT/SmallBitVector.h @@ -306,8 +306,8 @@ class SmallBitVector { 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 @@ class SmallBitVector { 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