mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
MC: Avoid some UB caused by left shifting a negative value. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
19eda5312a
commit
47ccfa7de8
@ -637,7 +637,7 @@ void MachObjectWriter::ComputeSymbolTable(
|
||||
unsigned Index = Rel.Sym->getIndex();
|
||||
assert(isInt<24>(Index));
|
||||
if (IsLittleEndian)
|
||||
Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (-1 << 24)) | Index | (1 << 27);
|
||||
Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (~0U << 24)) | Index | (1 << 27);
|
||||
else
|
||||
Rel.MRE.r_word1 = (Rel.MRE.r_word1 & 0xff) | Index << 8 | (1 << 4);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user