skip to content
==> README.md <==
1# @ajax/wasm-leb128
2
3LEB128 decoding exactly as the WebAssembly binary format defines it (spec §5.2.2): unsigned and
4signed readers for any width up to 64 bits (u32, u64, s32, s33 for block types, s64). Each returns the
5bytes it used, or 0 for a truncated encoding, one longer than ceil(N/7) bytes, or a last byte whose
6unused bits aren't zero (unsigned) or the sign (signed). Header-only and freestanding.
7
8Part of [alpha-c-mesh](https://github.com/thomasdavis/alpha-c-mesh)'s WebAssembly interpreter, which
9replaces wasmtime in the port of alpha-rust-mesh's `mesh-host/src/wasm.rs` (wasmparser did this there).
10
11Tests: `tests/leb128.c` (edge values, the length and padding rules, round trips).