| ... | @@ -1670,3 +1670,22 @@ const some_namespace = switch(@compile_var("os")) { | ... | @@ -1670,3 +1670,22 @@ const some_namespace = switch(@compile_var("os")) { |
| 1670 | linux => @import("a.zig"), | 1670 | linux => @import("a.zig"), |
| 1671 | else => @import("b.zig"), | 1671 | else => @import("b.zig"), |
| 1672 | }; | 1672 | }; |
| | 1673 | |
| | 1674 | |
| | 1675 | #attribute("test") |
| | 1676 | fn unsigned_64_bit_division() { |
| | 1677 | const result = div(1152921504606846976, 34359738365); |
| | 1678 | assert(result.quotient == 33554432); |
| | 1679 | assert(result.remainder == 100663296); |
| | 1680 | } |
| | 1681 | #static_eval_enable(false) |
| | 1682 | fn div(a: u64, b: u64) -> DivResult { |
| | 1683 | DivResult { |
| | 1684 | .quotient = a / b, |
| | 1685 | .remainder = a % b, |
| | 1686 | } |
| | 1687 | } |
| | 1688 | struct DivResult { |
| | 1689 | quotient: u64, |
| | 1690 | remainder: u64, |
| | 1691 | } |