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 › lldiv1 Private Function lldiv1 Doc Source Private Function std.math.big.int.lldiv1
fn lldiv1 (quo : []Limb , rem : *Limb , a : []const Limb , b : Limb ) void Params File math/big/int.zig: 4043
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066 fn lldiv1 (quo : []Limb , rem : *Limb , a : []const Limb , b : Limb ) void {
assert (a .len > 1 or a [0 ] >= b );
assert (quo .len >= a .len );
rem .* = 0 ;
for (a , 0 ..) |_ , ri | {
const i = a .len - ri - 1 ;
const pdiv = ((@as (DoubleLimb , rem .*) << limb_bits ) | a [i ]);
if (pdiv == 0 ) {
quo [i ] = 0 ;
rem .* = 0 ;
} else if (pdiv < b ) {
quo [i ] = 0 ;
rem .* = @as (Limb , @truncate (pdiv ));
} else if (pdiv == b ) {
quo [i ] = 1 ;
rem .* = 0 ;
} else {
quo [i ] = @as (Limb , @truncate (@divTrunc (pdiv , b )));
rem .* = @as (Limb , @truncate (pdiv - (quo [i ] *% b )));
}
}
}
Knuth 4.3.1, Exercise 16.