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.

divmod

divmodei4.divmod
fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32, tu: []u32, tv: []u32) !void

File

lib/compiler_rt/divmodei4.zig:29

Code

fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32, tu: []u32, tv: []u32) !void {
    const u_sign: i32 = @bitCast(u[limb(u.len - 1, u.len)]);
    const v_sign: i32 = @bitCast(v[limb(v.len - 1, v.len)]);
    if (u_sign < 0) neg(tu, u);
    if (v_sign < 0) neg(tv, v);
    try @call(.always_inline, udivmod, .{ q, r, if (u_sign < 0) tu else u, if (v_sign < 0) tv else v });
    if (q) |x| if (u_sign ^ v_sign < 0) neg(x, x);
    if (r) |x| if (u_sign < 0) neg(x, x);
}