llvm.org GIT mirror llvm / a0c671e
[SystemZ] Fix fallout from r288374 Avoid undefined behavior due to too-large shift count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288391 91177308-0d34-0410-b5e6-96231b3b80d8 Ulrich Weigand 3 years ago
1 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
100100
101101 // Big-endian insertion of Size bytes.
102102 Value = extractBitsForFixup(Kind, Value);
103 Value &= ((uint64_t)1 << BitSize) - 1;
103 if (BitSize < 64)
104 Value &= ((uint64_t)1 << BitSize) - 1;
104105 unsigned ShiftValue = (Size * 8) - 8;
105106 for (unsigned I = 0; I != Size; ++I) {
106107 Data[Offset + I] |= uint8_t(Value >> ShiftValue);