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
50.4M
{
26
50.4M
  const uint8_t *orig_p = p;
27
50.4M
  uint64_t Value = 0;
28
50.4M
  unsigned Shift = 0;
29
56.6M
  do {
30
56.6M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
56.6M
    Shift += 7;
32
56.6M
  } while (*p++ >= 128);
33
50.4M
  if (n)
34
50.4M
    *n = (unsigned)(p - orig_p);
35
50.4M
  return Value;
36
50.4M
}
ARMDisassembler.c:decodeULEB128
Line
Count
Source
25
18.8M
{
26
18.8M
  const uint8_t *orig_p = p;
27
18.8M
  uint64_t Value = 0;
28
18.8M
  unsigned Shift = 0;
29
20.8M
  do {
30
20.8M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
20.8M
    Shift += 7;
32
20.8M
  } while (*p++ >= 128);
33
18.8M
  if (n)
34
18.8M
    *n = (unsigned)(p - orig_p);
35
18.8M
  return Value;
36
18.8M
}
AArch64Disassembler.c:decodeULEB128
Line
Count
Source
25
8.77M
{
26
8.77M
  const uint8_t *orig_p = p;
27
8.77M
  uint64_t Value = 0;
28
8.77M
  unsigned Shift = 0;
29
9.61M
  do {
30
9.61M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
9.61M
    Shift += 7;
32
9.61M
  } while (*p++ >= 128);
33
8.77M
  if (n)
34
8.77M
    *n = (unsigned)(p - orig_p);
35
8.77M
  return Value;
36
8.77M
}
MipsDisassembler.c:decodeULEB128
Line
Count
Source
25
3.56M
{
26
3.56M
  const uint8_t *orig_p = p;
27
3.56M
  uint64_t Value = 0;
28
3.56M
  unsigned Shift = 0;
29
3.70M
  do {
30
3.70M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.70M
    Shift += 7;
32
3.70M
  } while (*p++ >= 128);
33
3.56M
  if (n)
34
3.56M
    *n = (unsigned)(p - orig_p);
35
3.56M
  return Value;
36
3.56M
}
PPCDisassembler.c:decodeULEB128
Line
Count
Source
25
5.64M
{
26
5.64M
  const uint8_t *orig_p = p;
27
5.64M
  uint64_t Value = 0;
28
5.64M
  unsigned Shift = 0;
29
5.87M
  do {
30
5.87M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
5.87M
    Shift += 7;
32
5.87M
  } while (*p++ >= 128);
33
5.64M
  if (n)
34
5.64M
    *n = (unsigned)(p - orig_p);
35
5.64M
  return Value;
36
5.64M
}
SparcDisassembler.c:decodeULEB128
Line
Count
Source
25
2.08M
{
26
2.08M
  const uint8_t *orig_p = p;
27
2.08M
  uint64_t Value = 0;
28
2.08M
  unsigned Shift = 0;
29
2.14M
  do {
30
2.14M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
2.14M
    Shift += 7;
32
2.14M
  } while (*p++ >= 128);
33
2.08M
  if (n)
34
2.08M
    *n = (unsigned)(p - orig_p);
35
2.08M
  return Value;
36
2.08M
}
SystemZDisassembler.c:decodeULEB128
Line
Count
Source
25
6.79M
{
26
6.79M
  const uint8_t *orig_p = p;
27
6.79M
  uint64_t Value = 0;
28
6.79M
  unsigned Shift = 0;
29
9.45M
  do {
30
9.45M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
9.45M
    Shift += 7;
32
9.45M
  } while (*p++ >= 128);
33
6.79M
  if (n)
34
6.79M
    *n = (unsigned)(p - orig_p);
35
6.79M
  return Value;
36
6.79M
}
XCoreDisassembler.c:decodeULEB128
Line
Count
Source
25
830k
{
26
830k
  const uint8_t *orig_p = p;
27
830k
  uint64_t Value = 0;
28
830k
  unsigned Shift = 0;
29
931k
  do {
30
931k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
931k
    Shift += 7;
32
931k
  } while (*p++ >= 128);
33
830k
  if (n)
34
830k
    *n = (unsigned)(p - orig_p);
35
830k
  return Value;
36
830k
}
TMS320C64xDisassembler.c:decodeULEB128
Line
Count
Source
25
970k
{
26
970k
  const uint8_t *orig_p = p;
27
970k
  uint64_t Value = 0;
28
970k
  unsigned Shift = 0;
29
992k
  do {
30
992k
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
992k
    Shift += 7;
32
992k
  } while (*p++ >= 128);
33
970k
  if (n)
34
970k
    *n = (unsigned)(p - orig_p);
35
970k
  return Value;
36
970k
}
RISCVDisassembler.c:decodeULEB128
Line
Count
Source
25
2.99M
{
26
2.99M
  const uint8_t *orig_p = p;
27
2.99M
  uint64_t Value = 0;
28
2.99M
  unsigned Shift = 0;
29
3.12M
  do {
30
3.12M
    Value += (uint64_t)(*p & 0x7f) << Shift;
31
3.12M
    Shift += 7;
32
3.12M
  } while (*p++ >= 128);
33
2.99M
  if (n)
34
2.99M
    *n = (unsigned)(p - orig_p);
35
2.99M
  return Value;
36
2.99M
}
Unexecuted instantiation: TriCoreDisassembler.c:decodeULEB128
37
38
#endif  // LLVM_SYSTEM_LEB128_H