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.

addLanesAll

Add lanes from data to N states in parallel with stride using SIMD

kangarootwelve.addLanesAll
fn addLanesAll(
    comptime N: usize,
    states: *[5][5]@Vector(N, u64),
    data: []const u8,
    lane_count: usize,
    lane_offset: usize,
) void

File

lib/std/crypto/kangarootwelve.zig:296

Code

fn addLanesAll(
    comptime N: usize,
    states: *[5][5]@Vector(N, u64),
    data: []const u8,
    lane_count: usize,
    lane_offset: usize,
) void {

    // Process lanes (at most 25 lanes in Keccak state)
    inline for (0..25) |xy| {
        if (xy < lane_count) {
            const x = xy % 5;
            const y = xy / 5;

            var loaded_data: @Vector(N, u64) = undefined;
            inline for (0..N) |i| {
                loaded_data[i] = load64(data[8 * (i * lane_offset + xy) ..]);
            }
            states[x][y] ^= loaded_data;
        }
    }
}