Coverage Report

Created: 2025-12-14 06:36

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
114M
{
26
114M
  const uint8_t *orig_p = p;
27
114M
  uint64_t Value = 0;
28
114M
  unsigned Shift = 0;
29
129M
  do {
30
129M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
129M
    Shift += 7;
32
129M
  } while (*p++ >= 128);
33
114M
  if (n)
34
114M
    *n = (unsigned)(p - orig_p);
35
114M
  return Value;
36
114M
}
ARMDisassembler.c:decodeULEB128
Line
Count
Source
25
47.0M
{
26
47.0M
  const uint8_t *orig_p = p;
27
47.0M
  uint64_t Value = 0;
28
47.0M
  unsigned Shift = 0;
29
51.8M
  do {
30
51.8M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
51.8M
    Shift += 7;
32
51.8M
  } while (*p++ >= 128);
33
47.0M
  if (n)
34
47.0M
    *n = (unsigned)(p - orig_p);
35
47.0M
  return Value;
36
47.0M
}
AArch64Disassembler.c:decodeULEB128
Line
Count
Source
25
17.7M
{
26
17.7M
  const uint8_t *orig_p = p;
27
17.7M
  uint64_t Value = 0;
28
17.7M
  unsigned Shift = 0;
29
19.5M
  do {
30
19.5M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
19.5M
    Shift += 7;
32
19.5M
  } while (*p++ >= 128);
33
17.7M
  if (n)
34
17.7M
    *n = (unsigned)(p - orig_p);
35
17.7M
  return Value;
36
17.7M
}
MipsDisassembler.c:decodeULEB128
Line
Count
Source
25
8.39M
{
26
8.39M
  const uint8_t *orig_p = p;
27
8.39M
  uint64_t Value = 0;
28
8.39M
  unsigned Shift = 0;
29
8.74M
  do {
30
8.74M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
8.74M
    Shift += 7;
32
8.74M
  } while (*p++ >= 128);
33
8.39M
  if (n)
34
8.39M
    *n = (unsigned)(p - orig_p);
35
8.39M
  return Value;
36
8.39M
}
PPCDisassembler.c:decodeULEB128
Line
Count
Source
25
9.75M
{
26
9.75M
  const uint8_t *orig_p = p;
27
9.75M
  uint64_t Value = 0;
28
9.75M
  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.75M
  if (n)
34
9.75M
    *n = (unsigned)(p - orig_p);
35
9.75M
  return Value;
36
9.75M
}
SparcDisassembler.c:decodeULEB128
Line
Count
Source
25
3.84M
{
26
3.84M
  const uint8_t *orig_p = p;
27
3.84M
  uint64_t Value = 0;
28
3.84M
  unsigned Shift = 0;
29
3.95M
  do {
30
3.95M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.95M
    Shift += 7;
32
3.95M
  } while (*p++ >= 128);
33
3.84M
  if (n)
34
3.84M
    *n = (unsigned)(p - orig_p);
35
3.84M
  return Value;
36
3.84M
}
SystemZDisassembler.c:decodeULEB128
Line
Count
Source
25
17.3M
{
26
17.3M
  const uint8_t *orig_p = p;
27
17.3M
  uint64_t Value = 0;
28
17.3M
  unsigned Shift = 0;
29
24.4M
  do {
30
24.4M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
24.4M
    Shift += 7;
32
24.4M
  } while (*p++ >= 128);
33
17.3M
  if (n)
34
17.3M
    *n = (unsigned)(p - orig_p);
35
17.3M
  return Value;
36
17.3M
}
XCoreDisassembler.c:decodeULEB128
Line
Count
Source
25
1.60M
{
26
1.60M
  const uint8_t *orig_p = p;
27
1.60M
  uint64_t Value = 0;
28
1.60M
  unsigned Shift = 0;
29
1.78M
  do {
30
1.78M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.78M
    Shift += 7;
32
1.78M
  } while (*p++ >= 128);
33
1.60M
  if (n)
34
1.60M
    *n = (unsigned)(p - orig_p);
35
1.60M
  return Value;
36
1.60M
}
TMS320C64xDisassembler.c:decodeULEB128
Line
Count
Source
25
2.01M
{
26
2.01M
  const uint8_t *orig_p = p;
27
2.01M
  uint64_t Value = 0;
28
2.01M
  unsigned Shift = 0;
29
2.05M
  do {
30
2.05M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
2.05M
    Shift += 7;
32
2.05M
  } while (*p++ >= 128);
33
2.01M
  if (n)
34
2.01M
    *n = (unsigned)(p - orig_p);
35
2.01M
  return Value;
36
2.01M
}
RISCVDisassembler.c:decodeULEB128
Line
Count
Source
25
6.48M
{
26
6.48M
  const uint8_t *orig_p = p;
27
6.48M
  uint64_t Value = 0;
28
6.48M
  unsigned Shift = 0;
29
6.76M
  do {
30
6.76M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
6.76M
    Shift += 7;
32
6.76M
  } while (*p++ >= 128);
33
6.48M
  if (n)
34
6.48M
    *n = (unsigned)(p - orig_p);
35
6.48M
  return Value;
36
6.48M
}
Unexecuted instantiation: TriCoreDisassembler.c:decodeULEB128
37
38
#endif  // LLVM_SYSTEM_LEB128_H