fn PackedIntIo(comptime Int: type, comptime endian: Endian) type

Provides a set of functions for reading and writing packed integers from a slice of bytes.

Parameters

Int: type,
endian: Endian,

Functions

fn get(bytes: []const u8, index: usize, bit_offset: u7) Int

Retrieves the integer at index from the packed data beginning at bit_offset

Retrieves the integer at index from the packed data beginning at bit_offset within bytes.

fn set(bytes: []u8, index: usize, bit_offset: u3, int: Int) void

Sets the integer at index to val within the packed data beginning at `bit_o…

Sets the integer at index to val within the packed data beginning at bit_offset into bytes.

fn slice(bytes: []u8, bit_offset: u3, start: usize, end: usize) PackedIntSliceEndian(Int, endian)

Provides a PackedIntSlice of the packed integers in bytes (which begins at `bi…

Provides a PackedIntSlice of the packed integers in bytes (which begins at bit_offset) from the element specified by start to the element specified by end.

fn sliceCast(bytes: []u8, comptime NewInt: type, comptime new_endian: Endian, bit_offset: u3, old_len: usize) PackedIntSliceEndian(NewInt, new_endian)

Recasts a packed slice to a version with elements of type NewInt and endiannes…

Recasts a packed slice to a version with elements of type NewInt and endianness new_endian. Slice will begin at bit_offset within bytes and the new length will be automatically calculated from old_len using the sizes of the current integer type and NewInt.