fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value: anytype, endian: std.builtin.Endian) void
[src]
Stores an integer to packed memory with provided bit_count, bit_offset, and signedness. If negative, the written value is sign-extended.
Example: const T = packed struct(u16){ a: u3, b: u7, c: u6 }; var st = T{ .a = 1, .b = 2, .c = 4 }; // st.b = 0x7f; var value: u64 = 0x7f; writeVarPackedInt(std.mem.asBytes(&st), @bitOffsetOf(T, “b”), 7, value, builtin.cpu.arch.endian());