Header menu logo B2R2

LEB128 Module

Provides functions for encoding/decoding LEB128 integers. LEB128 is a variable-length encoding scheme that is designed to compactly represent integers.

Types

Type Description

DecodeException

Raised when LEB128 decoding fails. This occurs when the continuation bit (MSB) is still set on the last permitted byte, meaning the encoded value exceeds the maximum byte length for the target type (5 bytes for 32-bit, 10 bytes for 64-bit).

Functions and values

Function or value Description

LEB128.decodeSInt32 span

Full Usage: LEB128.decodeSInt32 span

Parameters:
Returns: int32 * int

Decodes a LEB128-encoded signed integer into int32. Returns a tuple of (the decoded value, the number of bytes consumed).

span : ReadOnlySpan<byte>
Returns: int32 * int

LEB128.decodeSInt32Bytes bytes

Full Usage: LEB128.decodeSInt32Bytes bytes

Parameters:
    bytes : byte[]

Returns: int32 * int

Decodes a LEB128-encoded signed integer into int32 from a byte array. Returns a tuple of (the decoded value, the number of bytes consumed).

bytes : byte[]
Returns: int32 * int

LEB128.decodeSInt64 span

Full Usage: LEB128.decodeSInt64 span

Parameters:
Returns: int64 * int

Decodes a LEB128-encoded signed integer into int64. Returns a tuple of (the decoded value, the number of bytes consumed).

span : ReadOnlySpan<byte>
Returns: int64 * int

LEB128.decodeSInt64Bytes bytes

Full Usage: LEB128.decodeSInt64Bytes bytes

Parameters:
    bytes : byte[]

Returns: int64 * int

Decodes a LEB128-encoded signed integer into int64 from a byte array. Returns a tuple of (the decoded value, the number of bytes consumed).

bytes : byte[]
Returns: int64 * int

LEB128.decodeUInt32 span

Full Usage: LEB128.decodeUInt32 span

Parameters:
Returns: uint32 * int

Decodes a LEB128-encoded unsigned integer into uint32. Returns a tuple of (the decoded value, the number of bytes consumed).

span : ReadOnlySpan<byte>
Returns: uint32 * int

LEB128.decodeUInt32Bytes bytes

Full Usage: LEB128.decodeUInt32Bytes bytes

Parameters:
    bytes : byte[]

Returns: uint32 * int

Decodes a LEB128-encoded unsigned integer into uint32 from a byte array. Returns a tuple of (the decoded value, the number of bytes consumed).

bytes : byte[]
Returns: uint32 * int

LEB128.decodeUInt64 span

Full Usage: LEB128.decodeUInt64 span

Parameters:
Returns: uint64 * int

Decodes a LEB128-encoded unsigned integer into uint64. Returns a tuple of (the decoded value, the number of bytes consumed).

span : ReadOnlySpan<byte>
Returns: uint64 * int

LEB128.decodeUInt64Bytes bytes

Full Usage: LEB128.decodeUInt64Bytes bytes

Parameters:
    bytes : byte[]

Returns: uint64 * int

Decodes a LEB128-encoded unsigned integer into uint64 from a byte array. Returns a tuple of (the decoded value, the number of bytes consumed).

bytes : byte[]
Returns: uint64 * int

Type something to start searching.