Skip to content

Commit fc05a82

Browse files
committed
Revert "[LEB128] Factor out redundant code"
This reverts commit b96121c.
1 parent 275bec4 commit fc05a82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/include/llvm/Support/LEB128.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,17 @@ inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = nullptr,
138138
if (p == end) {
139139
if (error)
140140
*error = "malformed uleb128, extends past end";
141-
Value = 0;
142-
break;
141+
if (n)
142+
*n = (unsigned)(p - orig_p);
143+
return 0;
143144
}
144145
uint64_t Slice = *p & 0x7f;
145146
if ((Shift >= 64 && Slice != 0) || Slice << Shift >> Shift != Slice) {
146147
if (error)
147148
*error = "uleb128 too big for uint64";
148-
Value = 0;
149-
break;
149+
if (n)
150+
*n = (unsigned)(p - orig_p);
151+
return 0;
150152
}
151153
Value += Slice << Shift;
152154
Shift += 7;

0 commit comments

Comments
 (0)