Rizin
unix-like reverse engineering framework and cli tools
LEB128.h File Reference

Go to the source code of this file.

Functions

static uint64_t decodeULEB128 (const uint8_t *p, unsigned *n)
 Utility function to decode a ULEB128 value. More...
 

Function Documentation

◆ decodeULEB128()

static uint64_t decodeULEB128 ( const uint8_t p,
unsigned n 
)
inlinestatic

Utility function to decode a ULEB128 value.

Definition at line 24 of file LEB128.h.

25 {
26  const uint8_t *orig_p = p;
27  uint64_t Value = 0;
28  unsigned Shift = 0;
29  do {
30  Value += (uint64_t)(*p & 0x7f) << Shift;
31  Shift += 7;
32  } while (*p++ >= 128);
33  if (n)
34  *n = (unsigned)(p - orig_p);
35  return Value;
36 }
void * p
Definition: libc.cpp:67
static void struct sockaddr socklen_t static fromlen static backlog static fork char char char static envp int struct rusage static rusage struct utsname static buf struct sembuf unsigned
Definition: sflib.h:97
int n
Definition: mipsasm.c:19
unsigned long uint64_t
Definition: sftypes.h:28
unsigned char uint8_t
Definition: sftypes.h:31

References n, p, and unsigned.