MC: Avoid some UB caused by left shifting a negative value. NFC

llvm-svn: 237408
This commit is contained in:
Justin Bogner 2015-05-14 23:54:49 +00:00
parent ca32190379
commit d4e08a0897
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}