Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

PackedOptionalU15

Until #104 is implemented, a ?u15 takes 4 bytes, which is unacceptable as it doubles the size of this already massive structure.

Also, there are no to / from methods because LLVM 21 does not optimize away the conversion from and to ?u15.

Compress.PackedOptionalU15
const PackedOptionalU15 = packed struct(u16)

File

Code

const PackedOptionalU15 = packed struct(u16) {
    value: u15,
    is_null: bool,

    pub fn int(p: PackedOptionalU15) u16 {
        return @bitCast(p);
    }

    pub const null_bit: PackedOptionalU15 = .{ .value = 0, .is_null = true };
}