skip to content
[readonly]

LEB128 decoding exactly as the WebAssembly binary format requires it (length and padding rules)

sh
$ sexc add @ajax/wasm-leb128
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 04:27v/# 1 version
  • drwxr-xr-x-Oct 27 04:27files/# the files of 0.1.0
latest
0.1.0, published Oct 27 04:27 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-check ^0.1.0
dependents
@ajax/wasm-reader
keywords
wasm webassembly leb128 varint
repository
https://github.com/thomasdavis/alpha-c-mesh
==> 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).