https://github.com/diodechain/leb128
Elixir module for encoding and decoding LEB128 (Little Endian Base 128) encoded numbers.
https://github.com/diodechain/leb128
Last synced: about 2 months ago
JSON representation
Elixir module for encoding and decoding LEB128 (Little Endian Base 128) encoded numbers.
- Host: GitHub
- URL: https://github.com/diodechain/leb128
- Owner: diodechain
- License: apache-2.0
- Created: 2024-10-10T10:04:52.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-10-10T10:06:35.000Z (8 months ago)
- Last Synced: 2025-04-10T23:04:54.344Z (about 2 months ago)
- Language: Elixir
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LEB128
LEB128 is a library for encoding and decoding LEB128 encoded numbers. LEB128 is a variable-length encoding for integers that is used in the WebAssembly binary format.
https://en.wikipedia.org/wiki/LEB128
## Installation
The package can be installed by adding `leb128` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:leb128, "~> 0.1.0"}
]
end
```## Usage
```elixir
iex> LEB128.encode_unsigned(624_485)
<<0xE5, 0x8E, 0x26>>iex> LEB128.decode_unsigned!(<<0xE5, 0x8E, 0x26>>)
{624_485, ""}iex> LEB128.decode_unsigned!(<<0xE5, 0x8E>>)
{:error, :incomplete}
```