mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fix countLeadingZeros in the case that the bitwidth evenly divides the
word size. This fixes all reads of uninitialized data (buffer over read) and makes APInt.cpp memory clean, per valgrind. The only remaining problem is division in a few cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
62819f3144
commit
ab2b2c827c
@ -726,7 +726,10 @@ uint32_t APInt::countLeadingZeros() const {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Count - (APINT_BITS_PER_WORD - (BitWidth % APINT_BITS_PER_WORD));
|
||||
uint32_t remainder = BitWidth % APINT_BITS_PER_WORD;
|
||||
if (remainder)
|
||||
Count -= APINT_BITS_PER_WORD - remainder;
|
||||
return Count;
|
||||
}
|
||||
|
||||
/// countTrailingZeros - This function is a APInt version corresponding to
|
||||
|
Loading…
Reference in New Issue
Block a user