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.

bitMask

Creates an all-ones or all-zeros mask from a single bit value. Returns all 1s (0xFF...FF) if bit == 1, all 0s if bit == 0.

ml_kem.bitMask
fn bitMask(comptime T: type, bit: T) T

File

lib/std/crypto/ml_kem.zig:1839

Code

fn bitMask(comptime T: type, bit: T) T {
    const type_info = @typeInfo(T);
    if (type_info != .int or type_info.int.signedness != .unsigned) {
        @compileError("bitMask requires an unsigned integer type");
    }
    return -%bit;
}