aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-16 17:08:55 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-16 17:08:55 -0500
commitb6e7a0dadd86ce401e82ec53d6874e9934826c2d (patch)
tree27171640bb593bdc66d47b213f73f2b40ca68df3 /std
parentfc5d47b9b960aa08d65bf0dfe3d6395c811f793b (diff)
downloadzig-b6e7a0dadd86ce401e82ec53d6874e9934826c2d.tar.gz
zig-b6e7a0dadd86ce401e82ec53d6874e9934826c2d.zip
support arithmetic for non byte aligned integer types
see #261
Diffstat (limited to 'std')
-rw-r--r--std/math.zig12
1 files changed, 5 insertions, 7 deletions
diff --git a/std/math.zig b/std/math.zig
index 49396ca25d..cc2eb44795 100644
--- a/std/math.zig
+++ b/std/math.zig
@@ -71,15 +71,13 @@ fn getReturnTypeForAbs(comptime T: type) -> type {
fn testMath() {
@setFnTest(this);
+ testMathImpl();
+ comptime testMathImpl();
+}
+
+fn testMathImpl() {
assert(%%mulOverflow(i32, 3, 4) == 12);
assert(%%addOverflow(i32, 3, 4) == 7);
assert(%%subOverflow(i32, 3, 4) == -1);
assert(%%shlOverflow(i32, 0b11, 4) == 0b110000);
-
- comptime {
- assert(%%mulOverflow(i32, 3, 4) == 12);
- assert(%%addOverflow(i32, 3, 4) == 7);
- assert(%%subOverflow(i32, 3, 4) == -1);
- assert(%%shlOverflow(i32, 0b11, 4) == 0b110000);
- }
}