feature. See also
. The project being documented here (as the example) is the Zig library itself.
divmodei4.divmod
fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32, tu: []u32, tv: []u32) !void
File
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);
}