fn readPackedInt(comptime T: type, bytes: []const u8, bit_offset: usize, endian: Endian) T

Loads an integer from packed memory. Asserts that buffer contains at least bit_offset + @bitSizeOf(T) bits.

Example: const T = packed struct(u16){ a: u3, b: u7, c: u6 }; var st = T{ .a = 1, .b = 2, .c = 4 }; const b_field = readPackedInt(u7, std.mem.asBytes(&st), @bitOffsetOf(T, “b”), builtin.cpu.arch.endian());

Parameters

T: type,
bytes: []const u8,
bit_offset: usize,
endian: Endian,