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.

ChunkBatch

blake3.ChunkBatch
const ChunkBatch = struct

File

lib/std/crypto/blake3.zig:676

Code

const ChunkBatch = struct {
    input: []const u8,
    start_chunk: usize,
    end_chunk: usize,
    cvs: [][8]u32,
    key: [8]u32,
    flags: Flags,

    fn process(ctx: ChunkBatch) void {
        var cv_buffer: [max_simd_degree * Blake3.digest_length]u8 = undefined;
        var chunk_idx = ctx.start_chunk;

        while (chunk_idx < ctx.end_chunk) {
            const remaining = ctx.end_chunk - chunk_idx;
            const batch_size: usize = @min(remaining, max_simd_degree);
            const offset = chunk_idx * chunk_length;
            const batch_len = batch_size * chunk_length;

            const num_cvs = compressChunksParallel(
                ctx.input[offset..][0..batch_len],
                ctx.key,
                chunk_idx,
                ctx.flags,
                &cv_buffer,
            );

            for (0..num_cvs) |i| {
                const cv_bytes = cv_buffer[i * Blake3.digest_length ..][0..Blake3.digest_length];
                ctx.cvs[chunk_idx + i] = loadCvWords(cv_bytes.*);
            }

            chunk_idx += batch_size;
        }
    }
}