aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-08-13 20:27:25 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-08-13 20:32:32 -0700
commit28a9da8bfc1a791e0eaf8c643827da88ea70f7d1 (patch)
treeb15f8dfea2858c058d878d4917812d28202fe727 /lib/std/math.zig
parent576581bd7b78825ce27d6a73fc42dd90eab8fbd1 (diff)
downloadzig-28a9da8bfc1a791e0eaf8c643827da88ea70f7d1.tar.gz
zig-28a9da8bfc1a791e0eaf8c643827da88ea70f7d1.zip
stage2: implement while loops (bool condition)
* introduce a dump() function on Module.Fn which helpfully prints to stderr the ZIR representation of a function (can be called before attempting to codegen it). This is a debugging tool. * implement x86 codegen for loops * liveness: fix analysis of conditional branches. The logic was buggy in a couple ways: - it never actually saved the results into the IR instruction (fixed now) - it incorrectly labeled operands as dying when their true death was after the conditional branch ended (fixed now) * zir rendering is enhanced to show liveness analysis results. this helps when debugging liveness analysis. * fix bug in zir rendering not numbering instructions correctly closes #6021
Diffstat (limited to 'lib/std/math.zig')
-rw-r--r--lib/std/math.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 17237ea9f0..2c9065a89e 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -747,6 +747,7 @@ test "math.negateCast" {
/// Cast an integer to a different integer type. If the value doesn't fit,
/// return an error.
+/// TODO make this an optional not an error.
pub fn cast(comptime T: type, x: anytype) (error{Overflow}!T) {
comptime assert(@typeInfo(T) == .Int); // must pass an integer
comptime assert(@typeInfo(@TypeOf(x)) == .Int); // must pass an integer