Skip to main content

Module binary

Module binary 

Source
Expand description

Big-endian binary reading and writing, the equivalent of struct.unpack / struct.pack with > formats.

Structs§

Reader
A cursor over big-endian data.

Traits§

WriteBytes
Appending big-endian values to a byte buffer.

Functions§

calc_checksum
The sfnt checksum of a block of data, padded with NUL bytes to a multiple of four (calcChecksum).
fit
Converts an integer to a narrower type, failing like struct.pack does when the value is out of range.
get_search_range
searchRange, entrySelector and rangeShift for a binary search header (getSearchRange).
max_power_of_two
The highest exponent such that 2**exponent <= x, or 0 (maxPowerOfTwo).
pad4
Pads data with NUL bytes to a multiple of four.