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 standard library.
std › math › big › int › testOneShiftCaseAliasing Private Function testOneShiftCaseAliasing Doc Source Private Function std.math.big.int.testOneShiftCaseAliasing
fn testOneShiftCaseAliasing (func : fn ([]Limb , []const Limb , usize ) usize , case : Case , shift_direction : isize ) !void Params func : fn ([]Limb , []const Limb , usize ) usize case : Case shift_direction : isize File math/big/int.zig: 4866
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890 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 ]);
}
}