mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Support: Remove undefined behavior from &raw_ostream::operator<<
Don't negate signed integer types in &raw_ostream::operator<<(const FormattedNumber &FN). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218496 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
abf5bf221f
commit
346056ffc0
@ -433,7 +433,7 @@ raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
|
||||
char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
|
||||
char *CurPtr = EndPtr;
|
||||
bool Neg = (FN.DecValue < 0);
|
||||
uint64_t N = Neg ? -FN.DecValue : FN.DecValue;
|
||||
uint64_t N = Neg ? -static_cast<uint64_t>(FN.DecValue) : FN.DecValue;
|
||||
while (N) {
|
||||
*--CurPtr = '0' + char(N % 10);
|
||||
N /= 10;
|
||||
|
Loading…
Reference in New Issue
Block a user