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 › crypto › ff › ct_protected › mulWide Private Function mulWide Doc Source Private Function std.crypto.ff.ct_protected.mulWide
fn mulWide (x : Limb , y : Limb ) WideLimb Params File crypto/ff.zig: 908
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923 fn mulWide (x : Limb , y : Limb ) WideLimb {
const half_bits = @typeInfo (Limb ).int .bits / 2 ;
const Half = @Int (.unsigned , half_bits );
const x0 = @as (Half , @truncate (x ));
const x1 = @as (Half , @truncate (x >> half_bits ));
const y0 = @as (Half , @truncate (y ));
const y1 = @as (Half , @truncate (y >> half_bits ));
const w0 = math .mulWide (Half , x0 , y0 );
const t = math .mulWide (Half , x1 , y0 ) + (w0 >> half_bits );
var w1 : Limb = @as (Half , @truncate (t ));
const w2 = @as (Half , @truncate (t >> half_bits ));
w1 += math .mulWide (Half , x0 , y1 );
const hi = math .mulWide (Half , x1 , y1 ) + w2 + (w1 >> half_bits );
const lo = x *% y ;
return .{ .hi = hi , .lo = lo };
}
Multiplies two limbs and returns the result as a wide limb.