X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FADT%2FSmallBitVector.h;h=4aa3bc217f41bfb24465ccecc5457f6d2a1ff7fe;hp=ae3d645396fdb1f808634a44a15fbd9e3bbd0120;hb=df7186636e51e63281bd318234b7d97f25efe491;hpb=5134443f6020a327f39e87a0db4ddbd9660befb0 diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h index ae3d645396f..4aa3bc217f4 100644 --- a/include/llvm/ADT/SmallBitVector.h +++ b/include/llvm/ADT/SmallBitVector.h @@ -551,19 +551,18 @@ public: } private: - template + template void applyMask(const uint32_t *Mask, unsigned MaskWords) { - if (NumBaseBits == 64 && MaskWords >= 2) { - uint64_t M = Mask[0] | (uint64_t(Mask[1]) << 32); - if (InvertMask) M = ~M; - if (AddBits) setSmallBits(getSmallBits() | M); - else setSmallBits(getSmallBits() & ~M); - } else { - uint32_t M = Mask[0]; - if (InvertMask) M = ~M; - if (AddBits) setSmallBits(getSmallBits() | M); - else setSmallBits(getSmallBits() & ~M); - } + assert(MaskWords <= sizeof(uintptr_t) && "Mask is larger than base!"); + uintptr_t M = Mask[0]; + if (NumBaseBits == 64) + M |= uint64_t(Mask[1]) << 32; + if (InvertMask) + M = ~M; + if (AddBits) + setSmallBits(getSmallBits() | M); + else + setSmallBits(getSmallBits() & ~M); } };