[llvm] b96121c - [LEB128] Factor out redundant code
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 12:17:22 PST 2023
Author: Adrian Prantl
Date: 2023-11-29T12:16:32-08:00
New Revision: b96121c2e7de66154a70db5f202c9adce515aa45
URL: https://github.com/llvm/llvm-project/commit/b96121c2e7de66154a70db5f202c9adce515aa45
DIFF: https://github.com/llvm/llvm-project/commit/b96121c2e7de66154a70db5f202c9adce515aa45.diff
LOG: [LEB128] Factor out redundant code
Added:
Modified:
llvm/include/llvm/Support/LEB128.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
index 7ec19fee5d8ba51..76c93acaadfdcc7 100644
--- a/llvm/include/llvm/Support/LEB128.h
+++ b/llvm/include/llvm/Support/LEB128.h
@@ -138,17 +138,15 @@ inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = nullptr,
if (p == end) {
if (error)
*error = "malformed uleb128, extends past end";
- if (n)
- *n = (unsigned)(p - orig_p);
- return 0;
+ Value = 0;
+ break;
}
uint64_t Slice = *p & 0x7f;
if ((Shift >= 64 && Slice != 0) || Slice << Shift >> Shift != Slice) {
if (error)
*error = "uleb128 too big for uint64";
- if (n)
- *n = (unsigned)(p - orig_p);
- return 0;
+ Value = 0;
+ break;
}
Value += Slice << Shift;
Shift += 7;
More information about the llvm-commits
mailing list