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/ › math/ › big/ › int.zig › testOneShiftCaseAliasing
testOneShiftCaseAliasing
int.testOneShiftCaseAliasing
fn testOneShiftCaseAliasing (func : fn ([]Limb , []const Limb , usize ) usize , case : Case , shift_direction : isize ) !void
File
Code
fn testOneShiftCaseAliasing (func : fn ([]Limb , []const Limb , usize ) usize , case : Case , shift_direction : isize ) !void {
const padding = maxInt (Limb );
var r : [60 ]Limb = @splat (padding );
const base = 20 ;
assert (shift_direction == 1 or shift_direction == -1 );
for (0 ..10 ) |limb_shift | {
const shift = case [0 ];
const expected = case [1 ];
const data = case [2 ];
std .debug .assert (expected .len <= 20 );
@memset (&r , padding );
const final_limb_base : usize = @intCast (base + shift_direction * @as (isize , @intCast (limb_shift )));
const written_data = r [final_limb_base ..][0 ..data .len ];
@memcpy (written_data , data );
const len = func (r [base ..], written_data , shift );
try std .testing .expectEqual (expected .len , len );
try std .testing .expectEqualSlices (Limb , expected , r [base .. base + len ]);
}
}