/src/bloaty/third_party/capstone/LEB128.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- llvm/Support/LEB128.h - [SU]LEB128 utility functions -----*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file declares some utility functions for encoding SLEB128 and |
11 | | // ULEB128 values. |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | /* Capstone Disassembly Engine */ |
16 | | /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */ |
17 | | |
18 | | #ifndef CS_LLVM_SUPPORT_LEB128_H |
19 | | #define CS_LLVM_SUPPORT_LEB128_H |
20 | | |
21 | | #include "include/capstone/capstone.h" |
22 | | |
23 | | /// Utility function to decode a ULEB128 value. |
24 | | static inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n) |
25 | 0 | { |
26 | 0 | const uint8_t *orig_p = p; |
27 | 0 | uint64_t Value = 0; |
28 | 0 | unsigned Shift = 0; |
29 | 0 | do { |
30 | 0 | Value += (uint64_t)(*p & 0x7f) << Shift; |
31 | 0 | Shift += 7; |
32 | 0 | } while (*p++ >= 128); |
33 | 0 | if (n) |
34 | 0 | *n = (unsigned)(p - orig_p); |
35 | 0 | return Value; |
36 | 0 | } Unexecuted instantiation: ARMDisassembler.c:decodeULEB128 Unexecuted instantiation: AArch64Disassembler.c:decodeULEB128 Unexecuted instantiation: MipsDisassembler.c:decodeULEB128 Unexecuted instantiation: PPCDisassembler.c:decodeULEB128 Unexecuted instantiation: SparcDisassembler.c:decodeULEB128 Unexecuted instantiation: SystemZDisassembler.c:decodeULEB128 Unexecuted instantiation: XCoreDisassembler.c:decodeULEB128 Unexecuted instantiation: TMS320C64xDisassembler.c:decodeULEB128 |
37 | | |
38 | | #endif // LLVM_SYSTEM_LEB128_H |