Coverage Report

Created: 2025-11-11 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/capstonev5/LEB128.h
Line
Count
Source
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-2019 */
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
107M
{
26
107M
  const uint8_t *orig_p = p;
27
107M
  uint64_t Value = 0;
28
107M
  unsigned Shift = 0;
29
121M
  do {
30
121M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
121M
    Shift += 7;
32
121M
  } while (*p++ >= 128);
33
107M
  if (n)
34
107M
    *n = (unsigned)(p - orig_p);
35
107M
  return Value;
36
107M
}
ARMDisassembler.c:decodeULEB128
Line
Count
Source
25
46.5M
{
26
46.5M
  const uint8_t *orig_p = p;
27
46.5M
  uint64_t Value = 0;
28
46.5M
  unsigned Shift = 0;
29
51.4M
  do {
30
51.4M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
51.4M
    Shift += 7;
32
51.4M
  } while (*p++ >= 128);
33
46.5M
  if (n)
34
46.5M
    *n = (unsigned)(p - orig_p);
35
46.5M
  return Value;
36
46.5M
}
AArch64Disassembler.c:decodeULEB128
Line
Count
Source
25
15.8M
{
26
15.8M
  const uint8_t *orig_p = p;
27
15.8M
  uint64_t Value = 0;
28
15.8M
  unsigned Shift = 0;
29
17.4M
  do {
30
17.4M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
17.4M
    Shift += 7;
32
17.4M
  } while (*p++ >= 128);
33
15.8M
  if (n)
34
15.8M
    *n = (unsigned)(p - orig_p);
35
15.8M
  return Value;
36
15.8M
}
MipsDisassembler.c:decodeULEB128
Line
Count
Source
25
7.60M
{
26
7.60M
  const uint8_t *orig_p = p;
27
7.60M
  uint64_t Value = 0;
28
7.60M
  unsigned Shift = 0;
29
7.92M
  do {
30
7.92M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
7.92M
    Shift += 7;
32
7.92M
  } while (*p++ >= 128);
33
7.60M
  if (n)
34
7.60M
    *n = (unsigned)(p - orig_p);
35
7.60M
  return Value;
36
7.60M
}
PPCDisassembler.c:decodeULEB128
Line
Count
Source
25
9.80M
{
26
9.80M
  const uint8_t *orig_p = p;
27
9.80M
  uint64_t Value = 0;
28
9.80M
  unsigned Shift = 0;
29
10.1M
  do {
30
10.1M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
10.1M
    Shift += 7;
32
10.1M
  } while (*p++ >= 128);
33
9.80M
  if (n)
34
9.80M
    *n = (unsigned)(p - orig_p);
35
9.80M
  return Value;
36
9.80M
}
SparcDisassembler.c:decodeULEB128
Line
Count
Source
25
3.43M
{
26
3.43M
  const uint8_t *orig_p = p;
27
3.43M
  uint64_t Value = 0;
28
3.43M
  unsigned Shift = 0;
29
3.52M
  do {
30
3.52M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.52M
    Shift += 7;
32
3.52M
  } while (*p++ >= 128);
33
3.43M
  if (n)
34
3.43M
    *n = (unsigned)(p - orig_p);
35
3.43M
  return Value;
36
3.43M
}
SystemZDisassembler.c:decodeULEB128
Line
Count
Source
25
14.6M
{
26
14.6M
  const uint8_t *orig_p = p;
27
14.6M
  uint64_t Value = 0;
28
14.6M
  unsigned Shift = 0;
29
20.4M
  do {
30
20.4M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
20.4M
    Shift += 7;
32
20.4M
  } while (*p++ >= 128);
33
14.6M
  if (n)
34
14.6M
    *n = (unsigned)(p - orig_p);
35
14.6M
  return Value;
36
14.6M
}
XCoreDisassembler.c:decodeULEB128
Line
Count
Source
25
1.65M
{
26
1.65M
  const uint8_t *orig_p = p;
27
1.65M
  uint64_t Value = 0;
28
1.65M
  unsigned Shift = 0;
29
1.82M
  do {
30
1.82M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.82M
    Shift += 7;
32
1.82M
  } while (*p++ >= 128);
33
1.65M
  if (n)
34
1.65M
    *n = (unsigned)(p - orig_p);
35
1.65M
  return Value;
36
1.65M
}
TMS320C64xDisassembler.c:decodeULEB128
Line
Count
Source
25
1.96M
{
26
1.96M
  const uint8_t *orig_p = p;
27
1.96M
  uint64_t Value = 0;
28
1.96M
  unsigned Shift = 0;
29
2.01M
  do {
30
2.01M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
2.01M
    Shift += 7;
32
2.01M
  } while (*p++ >= 128);
33
1.96M
  if (n)
34
1.96M
    *n = (unsigned)(p - orig_p);
35
1.96M
  return Value;
36
1.96M
}
RISCVDisassembler.c:decodeULEB128
Line
Count
Source
25
5.98M
{
26
5.98M
  const uint8_t *orig_p = p;
27
5.98M
  uint64_t Value = 0;
28
5.98M
  unsigned Shift = 0;
29
6.24M
  do {
30
6.24M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
6.24M
    Shift += 7;
32
6.24M
  } while (*p++ >= 128);
33
5.98M
  if (n)
34
5.98M
    *n = (unsigned)(p - orig_p);
35
5.98M
  return Value;
36
5.98M
}
Unexecuted instantiation: TriCoreDisassembler.c:decodeULEB128
37
38
#endif  // LLVM_SYSTEM_LEB128_H