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 › compiler_rt/ › limb64.zig › __cmp_limb64
__cmp_limb64
limb64.__cmp_limb64
fn __cmp_limb64 (a_ptr : [*]const u64 , b_ptr : [*]const u64 , is_signed : bool , bits : u16 ) callconv (.c ) i8
File
Code
fn __cmp_limb64 (a_ptr : [*]const u64 , b_ptr : [*]const u64 , is_signed : bool , bits : u16 ) callconv (.c ) i8 {
const limb_cnt = usedLimbCount (bits );
const a = constLimbs (a_ptr , bits );
const b = constLimbs (b_ptr , bits );
var i : usize = 0 ;
if (is_signed ) {
const sa : i64 = @bitCast (limbGet (a , limb_cnt - 1 ));
const sb : i64 = @bitCast (limbGet (b , limb_cnt - 1 ));
if (sa < sb ) return -1 ;
if (sa > sb ) return 1 ;
i += 1 ;
}
while (i < limb_cnt ) : (i += 1 ) {
const ai = limbGet (a , limb_cnt - 1 - i );
const bi = limbGet (b , limb_cnt - 1 - i );
if (ai < bi ) return -1 ;
if (ai > bi ) return 1 ;
}
return 0 ;
}