Expand description
32-bit integer packing for EITE.
Despite the name suggesting arbitrary 32-bit integers, pack32 encodes
integers as single WTF-8 codepoints. Consequently, the supported range of
integers is restricted to the Unicode/WTF-8 codepoint range:
0x0000_0000..=0x0010_FFFF (0 through 1,114,111).
Values in this range, including surrogate codepoints (0xD800..=0xDFFF),
are valid and round-trip successfully through unpack32.
Any value exceeding 0x0010_FFFF (i.e. 0x0011_0000..=u32::MAX) will fail
with an error when passed to pack32.
Constants§
- PACK32_
MAX - Maximum integer value supported by
pack32(0x0010_FFFF, 1,114,111). - PACK32_
MIN - Minimum integer value supported by
pack32(0).
Functions§
- is_
pack32_ char - Test whether the given byte slice is a valid single WTF-8 codepoint
sequence (representing a value in
PACK32_MIN..=PACK32_MAX). - pack32
- Pack a 32-bit integer into a WTF-8 byte sequence representing a single logical codepoint.
- unpack32
- Unpack a single WTF-8 sequence into its codepoint (as u32).