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 |
|
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
|
|
Decodes a LEB128-encoded signed integer into int32. Returns a tuple of (the decoded value, the number of bytes consumed).
|
Full Usage:
LEB128.decodeSInt32Bytes bytes
Parameters:
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).
|
|
Decodes a LEB128-encoded signed integer into int64. Returns a tuple of (the decoded value, the number of bytes consumed).
|
Full Usage:
LEB128.decodeSInt64Bytes bytes
Parameters:
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).
|
|
Decodes a LEB128-encoded unsigned integer into uint32. Returns a tuple of (the decoded value, the number of bytes consumed).
|
Full Usage:
LEB128.decodeUInt32Bytes bytes
Parameters:
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).
|
|
Decodes a LEB128-encoded unsigned integer into uint64. Returns a tuple of (the decoded value, the number of bytes consumed).
|
Full Usage:
LEB128.decodeUInt64Bytes bytes
Parameters:
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).
|
B2R2