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.

__bitreverse_limb64

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

File

lib/compiler_rt/limb64.zig:841

Code

fn __bitreverse_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);

    var i: usize = 0;
    while (i < limb_cnt) : (i += 1) {
        const j = limb_cnt - 1 - i;
        limbSet(out, j, @bitReverse(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);
}