Coverage Report

Created: 2025-10-10 06:20

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
40.5M
{
26
40.5M
  const uint8_t *orig_p = p;
27
40.5M
  uint64_t Value = 0;
28
40.5M
  unsigned Shift = 0;
29
45.7M
  do {
30
45.7M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
45.7M
    Shift += 7;
32
45.7M
  } while (*p++ >= 128);
33
40.5M
  if (n)
34
40.5M
    *n = (unsigned)(p - orig_p);
35
40.5M
  return Value;
36
40.5M
}
ARMDisassembler.c:decodeULEB128
Line
Count
Source
25
16.8M
{
26
16.8M
  const uint8_t *orig_p = p;
27
16.8M
  uint64_t Value = 0;
28
16.8M
  unsigned Shift = 0;
29
18.6M
  do {
30
18.6M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
18.6M
    Shift += 7;
32
18.6M
  } while (*p++ >= 128);
33
16.8M
  if (n)
34
16.8M
    *n = (unsigned)(p - orig_p);
35
16.8M
  return Value;
36
16.8M
}
AArch64Disassembler.c:decodeULEB128
Line
Count
Source
25
6.19M
{
26
6.19M
  const uint8_t *orig_p = p;
27
6.19M
  uint64_t Value = 0;
28
6.19M
  unsigned Shift = 0;
29
6.81M
  do {
30
6.81M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
6.81M
    Shift += 7;
32
6.81M
  } while (*p++ >= 128);
33
6.19M
  if (n)
34
6.19M
    *n = (unsigned)(p - orig_p);
35
6.19M
  return Value;
36
6.19M
}
MipsDisassembler.c:decodeULEB128
Line
Count
Source
25
2.90M
{
26
2.90M
  const uint8_t *orig_p = p;
27
2.90M
  uint64_t Value = 0;
28
2.90M
  unsigned Shift = 0;
29
3.03M
  do {
30
3.03M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.03M
    Shift += 7;
32
3.03M
  } while (*p++ >= 128);
33
2.90M
  if (n)
34
2.90M
    *n = (unsigned)(p - orig_p);
35
2.90M
  return Value;
36
2.90M
}
PPCDisassembler.c:decodeULEB128
Line
Count
Source
25
3.67M
{
26
3.67M
  const uint8_t *orig_p = p;
27
3.67M
  uint64_t Value = 0;
28
3.67M
  unsigned Shift = 0;
29
3.82M
  do {
30
3.82M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.82M
    Shift += 7;
32
3.82M
  } while (*p++ >= 128);
33
3.67M
  if (n)
34
3.67M
    *n = (unsigned)(p - orig_p);
35
3.67M
  return Value;
36
3.67M
}
SparcDisassembler.c:decodeULEB128
Line
Count
Source
25
1.55M
{
26
1.55M
  const uint8_t *orig_p = p;
27
1.55M
  uint64_t Value = 0;
28
1.55M
  unsigned Shift = 0;
29
1.60M
  do {
30
1.60M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.60M
    Shift += 7;
32
1.60M
  } while (*p++ >= 128);
33
1.55M
  if (n)
34
1.55M
    *n = (unsigned)(p - orig_p);
35
1.55M
  return Value;
36
1.55M
}
SystemZDisassembler.c:decodeULEB128
Line
Count
Source
25
5.91M
{
26
5.91M
  const uint8_t *orig_p = p;
27
5.91M
  uint64_t Value = 0;
28
5.91M
  unsigned Shift = 0;
29
8.24M
  do {
30
8.24M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
8.24M
    Shift += 7;
32
8.24M
  } while (*p++ >= 128);
33
5.91M
  if (n)
34
5.91M
    *n = (unsigned)(p - orig_p);
35
5.91M
  return Value;
36
5.91M
}
XCoreDisassembler.c:decodeULEB128
Line
Count
Source
25
499k
{
26
499k
  const uint8_t *orig_p = p;
27
499k
  uint64_t Value = 0;
28
499k
  unsigned Shift = 0;
29
548k
  do {
30
548k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
548k
    Shift += 7;
32
548k
  } while (*p++ >= 128);
33
499k
  if (n)
34
499k
    *n = (unsigned)(p - orig_p);
35
499k
  return Value;
36
499k
}
TMS320C64xDisassembler.c:decodeULEB128
Line
Count
Source
25
735k
{
26
735k
  const uint8_t *orig_p = p;
27
735k
  uint64_t Value = 0;
28
735k
  unsigned Shift = 0;
29
752k
  do {
30
752k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
752k
    Shift += 7;
32
752k
  } while (*p++ >= 128);
33
735k
  if (n)
34
735k
    *n = (unsigned)(p - orig_p);
35
735k
  return Value;
36
735k
}
RISCVDisassembler.c:decodeULEB128
Line
Count
Source
25
2.19M
{
26
2.19M
  const uint8_t *orig_p = p;
27
2.19M
  uint64_t Value = 0;
28
2.19M
  unsigned Shift = 0;
29
2.28M
  do {
30
2.28M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
2.28M
    Shift += 7;
32
2.28M
  } while (*p++ >= 128);
33
2.19M
  if (n)
34
2.19M
    *n = (unsigned)(p - orig_p);
35
2.19M
  return Value;
36
2.19M
}
Unexecuted instantiation: TriCoreDisassembler.c:decodeULEB128
37
38
#endif  // LLVM_SYSTEM_LEB128_H