core/encoding/varint

encoding_varint

Types

1

Constants

1

LEB128_MAX_BYTES

LEB128_MAX_BYTES :: 19Source

Copyright 2022 Jeroen van Rijn <nom@duclavier.com>.

Made available under Odin's license.

	List of contributors:
		Jeroen van Rijn: Initial implementation.
In theory we should use the bigint package. In practice, varints bigger than this indicate a corrupted file.
Instead we'll set limits on the values we'll encode/decode
18 * 7 bits = 126, which means that a possible 19th byte may at most be `0b0000_0011`.

Procedures

6

decode_uleb128_byte

decode_uleb128_byte :: proc(input: u8, offset: int, accumulator: u128) -> (val: u128, size: int, err: Error)Source

Decodes an unsigned LEB128 integer into value a byte at a time. Returns .None when decoded properly, .Value_Too_Large when they value exceeds the limits of a u128, and .Buffer_Too_Small when it's not yet fully decoded.

Procedure Groups

2

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.