Skip to content

Commit 4e58c0d

Browse files
committed
[LEB128] Factor out redundant code
(cherry picked from commit 643f25f)
1 parent 320a1d8 commit 4e58c0d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/include/llvm/Support/LEB128.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,15 @@ 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-
if (n)
142-
*n = (unsigned)(p - orig_p);
143-
return 0;
141+
Value = 0;
142+
break;
144143
}
145144
uint64_t Slice = *p & 0x7f;
146145
if ((Shift >= 64 && Slice != 0) || Slice << Shift >> Shift != Slice) {
147146
if (error)
148147
*error = "uleb128 too big for uint64";
149-
if (n)
150-
*n = (unsigned)(p - orig_p);
151-
return 0;
148+
Value = 0;
149+
break;
152150
}
153151
Value += Slice << Shift;
154152
Shift += 7;

0 commit comments

Comments
 (0)