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.

__byteswap_limb64

limb64.__byteswap_limb64
fn __byteswap_limb64(out_ptr: [*]u64, a_ptr: [*]const u64, is_signed: bool, bits: u16) callconv(.c) void

File

lib/compiler_rt/limb64.zig:891

Code

fn __byteswap_limb64(out_ptr: [*]u64, a_ptr: [*]const u64, is_signed: bool, bits: u16) callconv(.c) void {
    const limb_cnt = usedLimbCount(bits);
    const out = varLimbs(out_ptr, bits);
    const a = constLimbs(a_ptr, bits);

    assert(bits % 8 == 0);

    var i: usize = 0;
    while (i < limb_cnt) : (i += 1) {
        const j = limb_cnt - 1 - i;
        limbSet(out, j, @byteSwap(limbGet(a, i)));
    }

    if (bits % 64 != 0) {
        __shr_limb64(out_ptr, out_ptr, 64 - bits % 64, is_signed, bits);
    }
    fixLastLimb(out_ptr, is_signed, bits);
}