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.

limbWrap

limb64.limbWrap
fn limbWrap(limb: u64, is_signed: bool, bits: u16) u64

File

lib/compiler_rt/limb64.zig:90

Code

fn limbWrap(limb: u64, is_signed: bool, bits: u16) u64 {
    assert(bits % 64 != 0);
    const pad_bits: u6 = @intCast(64 - bits % 64);
    if (!is_signed) {
        const s = limb << pad_bits;
        return s >> pad_bits;
    } else {
        const s = @as(i64, @bitCast(limb)) << pad_bits;
        return @bitCast(s >> pad_bits);
    }
}