mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
add 64 bit division test
This commit is contained in:
parent
7f90dbbb11
commit
50310cf9df
@ -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,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user