forked from OSchip/llvm-project
tighten up a couple of assertions. hitting the BitPosition == BitWidth case that was previously not caught resulted in nasty corruption of APInts that (on my system at least) could not be detected using UBSan, ASan, or Valgrind. this patch does not cause any extra failures in a check-all nor does it interfere with bootstrapping. David Blaikie informally approved this change.
llvm-svn: 347148
This commit is contained in:
parent
35f504c113
commit
ab7781493d
|
@ -1395,7 +1395,7 @@ public:
|
|||
///
|
||||
/// Set the given bit to 1 whose position is given as "bitPosition".
|
||||
void setBit(unsigned BitPosition) {
|
||||
assert(BitPosition <= BitWidth && "BitPosition out of range");
|
||||
assert(BitPosition < BitWidth && "BitPosition out of range");
|
||||
WordType Mask = maskBit(BitPosition);
|
||||
if (isSingleWord())
|
||||
U.VAL |= Mask;
|
||||
|
@ -1454,7 +1454,7 @@ public:
|
|||
///
|
||||
/// Set the given bit to 0 whose position is given as "bitPosition".
|
||||
void clearBit(unsigned BitPosition) {
|
||||
assert(BitPosition <= BitWidth && "BitPosition out of range");
|
||||
assert(BitPosition < BitWidth && "BitPosition out of range");
|
||||
WordType Mask = ~maskBit(BitPosition);
|
||||
if (isSingleWord())
|
||||
U.VAL &= Mask;
|
||||
|
|
Loading…
Reference in New Issue