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.

times

Computes mat * vec over GF(2), where mat is a 32x32 binary matrix and vec is a 32-bit vector. This somewhat "simulates" how bits propagate through the CRC register during shifting.

Crc32c.times
fn times(mat: *const [32]u32, vec: u32) u32

File

lib/std/hash/crc/Crc32c.zig:114

Code

fn times(mat: *const [32]u32, vec: u32) u32 {
    var sum: u32 = 0;
    var v = vec;
    var i: u32 = 0;
    while (v != 0) {
        if (v & 1 != 0) sum ^= mat[i];
        v >>= 1;
        i += 1;
    }
    return sum;
}