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.

transposeMsg

blake3.transposeMsg
fn transposeMsg(comptime Vec: type, comptime n: comptime_int, inputs: [n][*]const u8, block_offset: usize, out: *[16]Vec) void

File

lib/std/crypto/blake3.zig:223

Code

fn transposeMsg(comptime Vec: type, comptime n: comptime_int, inputs: [n][*]const u8, block_offset: usize, out: *[16]Vec) void {
    const info = @typeInfo(Vec);
    if (info != .vector) @compileError("transposeMsg requires a vector type");
    if (info.vector.len != n) @compileError("vector width must match N");

    var temp: [n][16]u32 = undefined;

    for (0..n) |i| {
        const block = inputs[i] + block_offset;
        for (0..16) |j| {
            temp[i][j] = load32(block[j * 4 ..][0..4]);
        }
    }

    for (0..16) |j| {
        var result: Vec = undefined;
        inline for (0..n) |i| {
            result[i] = temp[i][j];
        }
        out[j] = result;
    }
}