add 64 bit division test

This commit is contained in:
Andrew Kelley 2016-05-15 00:42:48 -07:00
parent 7f90dbbb11
commit 50310cf9df

View File

@ -1670,3 +1670,22 @@ const some_namespace = switch(@compile_var("os")) {
linux => @import("a.zig"),
else => @import("b.zig"),
};
#attribute("test")
fn unsigned_64_bit_division() {
const result = div(1152921504606846976, 34359738365);
assert(result.quotient == 33554432);
assert(result.remainder == 100663296);
}
#static_eval_enable(false)
fn div(a: u64, b: u64) -> DivResult {
DivResult {
.quotient = a / b,
.remainder = a % b,
}
}
struct DivResult {
quotient: u64,
remainder: u64,
}