Coverage Report

Created: 2025-11-24 06:12

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
7.19M
{
26
7.19M
  const uint8_t *orig_p = p;
27
7.19M
  uint64_t Value = 0;
28
7.19M
  unsigned Shift = 0;
29
8.09M
  do {
30
8.09M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
8.09M
    Shift += 7;
32
8.09M
  } while (*p++ >= 128);
33
7.19M
  if (n)
34
7.19M
    *n = (unsigned)(p - orig_p);
35
7.19M
  return Value;
36
7.19M
}
ARMDisassembler.c:decodeULEB128
Line
Count
Source
25
2.61M
{
26
2.61M
  const uint8_t *orig_p = p;
27
2.61M
  uint64_t Value = 0;
28
2.61M
  unsigned Shift = 0;
29
2.89M
  do {
30
2.89M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
2.89M
    Shift += 7;
32
2.89M
  } while (*p++ >= 128);
33
2.61M
  if (n)
34
2.61M
    *n = (unsigned)(p - orig_p);
35
2.61M
  return Value;
36
2.61M
}
AArch64Disassembler.c:decodeULEB128
Line
Count
Source
25
1.22M
{
26
1.22M
  const uint8_t *orig_p = p;
27
1.22M
  uint64_t Value = 0;
28
1.22M
  unsigned Shift = 0;
29
1.35M
  do {
30
1.35M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.35M
    Shift += 7;
32
1.35M
  } while (*p++ >= 128);
33
1.22M
  if (n)
34
1.22M
    *n = (unsigned)(p - orig_p);
35
1.22M
  return Value;
36
1.22M
}
MipsDisassembler.c:decodeULEB128
Line
Count
Source
25
410k
{
26
410k
  const uint8_t *orig_p = p;
27
410k
  uint64_t Value = 0;
28
410k
  unsigned Shift = 0;
29
424k
  do {
30
424k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
424k
    Shift += 7;
32
424k
  } while (*p++ >= 128);
33
410k
  if (n)
34
410k
    *n = (unsigned)(p - orig_p);
35
410k
  return Value;
36
410k
}
PPCDisassembler.c:decodeULEB128
Line
Count
Source
25
1.05M
{
26
1.05M
  const uint8_t *orig_p = p;
27
1.05M
  uint64_t Value = 0;
28
1.05M
  unsigned Shift = 0;
29
1.09M
  do {
30
1.09M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.09M
    Shift += 7;
32
1.09M
  } while (*p++ >= 128);
33
1.05M
  if (n)
34
1.05M
    *n = (unsigned)(p - orig_p);
35
1.05M
  return Value;
36
1.05M
}
SparcDisassembler.c:decodeULEB128
Line
Count
Source
25
316k
{
26
316k
  const uint8_t *orig_p = p;
27
316k
  uint64_t Value = 0;
28
316k
  unsigned Shift = 0;
29
321k
  do {
30
321k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
321k
    Shift += 7;
32
321k
  } while (*p++ >= 128);
33
316k
  if (n)
34
316k
    *n = (unsigned)(p - orig_p);
35
316k
  return Value;
36
316k
}
SystemZDisassembler.c:decodeULEB128
Line
Count
Source
25
1.01M
{
26
1.01M
  const uint8_t *orig_p = p;
27
1.01M
  uint64_t Value = 0;
28
1.01M
  unsigned Shift = 0;
29
1.41M
  do {
30
1.41M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
1.41M
    Shift += 7;
32
1.41M
  } while (*p++ >= 128);
33
1.01M
  if (n)
34
1.01M
    *n = (unsigned)(p - orig_p);
35
1.01M
  return Value;
36
1.01M
}
XCoreDisassembler.c:decodeULEB128
Line
Count
Source
25
61.0k
{
26
61.0k
  const uint8_t *orig_p = p;
27
61.0k
  uint64_t Value = 0;
28
61.0k
  unsigned Shift = 0;
29
67.8k
  do {
30
67.8k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
67.8k
    Shift += 7;
32
67.8k
  } while (*p++ >= 128);
33
61.0k
  if (n)
34
61.0k
    *n = (unsigned)(p - orig_p);
35
61.0k
  return Value;
36
61.0k
}
TMS320C64xDisassembler.c:decodeULEB128
Line
Count
Source
25
68.8k
{
26
68.8k
  const uint8_t *orig_p = p;
27
68.8k
  uint64_t Value = 0;
28
68.8k
  unsigned Shift = 0;
29
70.6k
  do {
30
70.6k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
70.6k
    Shift += 7;
32
70.6k
  } while (*p++ >= 128);
33
68.8k
  if (n)
34
68.8k
    *n = (unsigned)(p - orig_p);
35
68.8k
  return Value;
36
68.8k
}
RISCVDisassembler.c:decodeULEB128
Line
Count
Source
25
425k
{
26
425k
  const uint8_t *orig_p = p;
27
425k
  uint64_t Value = 0;
28
425k
  unsigned Shift = 0;
29
444k
  do {
30
444k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
444k
    Shift += 7;
32
444k
  } while (*p++ >= 128);
33
425k
  if (n)
34
425k
    *n = (unsigned)(p - orig_p);
35
425k
  return Value;
36
425k
}
Unexecuted instantiation: TriCoreDisassembler.c:decodeULEB128
37
38
#endif  // LLVM_SYSTEM_LEB128_H