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.

FinalLeafContext

kangarootwelve.FinalLeafContext
fn FinalLeafContext(comptime Variant: type) type

File

lib/std/crypto/kangarootwelve.zig:812

Code

fn FinalLeafContext(comptime Variant: type) type {
    return struct {
        view: *const MultiSliceView,
        start_offset: usize,
        leaf_len: usize,
        output_cv: []align(@alignOf(u64)) u8,

        fn process(ctx: @This()) void {
            const cv_size = Variant.cv_size;
            var leaf_buffer: [chunk_size]u8 = undefined;
            var cv_buffer: [64]u8 = undefined;

            if (ctx.view.tryGetSlice(ctx.start_offset, ctx.start_offset + ctx.leaf_len)) |leaf_data| {
                const cv_slice = MultiSliceView.init(leaf_data, &[_]u8{}, &[_]u8{});
                Variant.turboShakeToBuffer(&cv_slice, 0x0B, cv_buffer[0..cv_size]);
            } else {
                ctx.view.copyRange(ctx.start_offset, ctx.start_offset + ctx.leaf_len, leaf_buffer[0..ctx.leaf_len]);
                const cv_slice = MultiSliceView.init(leaf_buffer[0..ctx.leaf_len], &[_]u8{}, &[_]u8{});
                Variant.turboShakeToBuffer(&cv_slice, 0x0B, cv_buffer[0..cv_size]);
            }
            @memcpy(ctx.output_cv[0..cv_size], cv_buffer[0..cv_size]);
        }
    };
}