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