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.
Zig › std/ › crypto/ › blake3.zig › processParentBatchSIMD
processParentBatchSIMD
blake3.processParentBatchSIMD
fn processParentBatchSIMD (ctx : ParentBatchContext ) void
File
Code
fn processParentBatchSIMD (ctx : ParentBatchContext ) void {
const num_parents = ctx .end_idx - ctx .start_idx ;
if (num_parents == 0 ) return ;
var input_bytes : [max_simd_degree * 2 * Blake3 .digest_length ]u8 = undefined ;
var output_bytes : [max_simd_degree * Blake3 .digest_length ]u8 = undefined ;
var parents_array : [max_simd_degree ][*]const u8 = undefined ;
var processed : usize = 0 ;
while (processed < num_parents ) {
const batch_size : usize = @min (num_parents - processed , max_simd_degree );
for (0 ..batch_size ) |i | {
const pair_idx = ctx .start_idx + processed + i ;
const left_cv = ctx .input_cvs [pair_idx * 2 ];
const right_cv = ctx .input_cvs [pair_idx * 2 + 1 ];
for (0 ..8 ) |j | {
store32 (input_bytes [i * 64 + j * 4 ..][0 ..4 ], left_cv [j ]);
store32 (input_bytes [i * 64 + 32 + j * 4 ..][0 ..4 ], right_cv [j ]);
}
parents_array [i ] = input_bytes [i * 64 ..].ptr ;
}
hashMany (parents_array [0 ..batch_size ], batch_size , 1 , ctx .key , 0 , false , ctx .flags .with (.{ .parent = true }), .{}, .{}, output_bytes [0 .. batch_size * Blake3 .digest_length ]);
for (0 ..batch_size ) |i | {
const output_idx = ctx .start_idx + processed + i ;
ctx .output_cvs [output_idx ] = loadCvWords (output_bytes [i * Blake3 .digest_length ..][0 ..Blake3 .digest_length ].*);
}
processed += batch_size ;
}
}