inline fn div_i32(n: i32, d: i32) i32
inline fn div_i32(n: i32, d: i32) i32 { // Set aside the sign of the quotient. const sign: u32 = @bitCast((n ^ d) >> 31); // Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). const abs_n = (n ^ (n >> 31)) -% (n >> 31); const abs_d = (d ^ (d >> 31)) -% (d >> 31); // abs(a) / abs(b) const res = @as(u32, @bitCast(abs_n)) / @as(u32, @bitCast(abs_d)); // Apply sign of quotient to result and return. return @bitCast((res ^ sign) -% sign); }