Skip to content

Commit 275bec4

Browse files
committed
Revert "[LEB128] Don't handle edge cases in every loop iteration"
This reverts commit 0cc2acc.
1 parent 77e5c5d commit 275bec4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/include/llvm/Support/LEB128.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = nullptr,
142142
break;
143143
}
144144
uint64_t Slice = *p & 0x7f;
145-
if (Shift >= 63 && ((Shift == 63 && (Slice << Shift >> Shift) != Slice) ||
146-
(Shift > 63 && Slice != 0))) {
145+
if ((Shift >= 64 && Slice != 0) || Slice << Shift >> Shift != Slice) {
147146
if (error)
148147
*error = "uleb128 too big for uint64";
149148
Value = 0;
@@ -178,8 +177,8 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
178177
}
179178
Byte = *p;
180179
uint64_t Slice = Byte & 0x7f;
181-
if ((Shift >= 63) && ((Shift == 63 && Slice != 0 && Slice != 0x7f) ||
182-
(Shift > 63 && Slice != (Value < 0 ? 0x7f : 0x00)))) {
180+
if ((Shift >= 64 && Slice != (Value < 0 ? 0x7f : 0x00)) ||
181+
(Shift == 63 && Slice != 0 && Slice != 0x7f)) {
183182
if (error)
184183
*error = "sleb128 too big for int64";
185184
if (n)

0 commit comments

Comments
 (0)