diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
| commit | d917815d8111b98dc237cbe2c723fa63018e02b1 (patch) | |
| tree | ce12771a86b2412ee9692ca73d3ca49abe5da3ce /std/math/trunc.zig | |
| parent | 8bc523219c66427951e5339550502871547f2138 (diff) | |
| download | zig-d917815d8111b98dc237cbe2c723fa63018e02b1.tar.gz zig-d917815d8111b98dc237cbe2c723fa63018e02b1.zip | |
explicitly return from blocks
instead of last statement being expression value
closes #629
Diffstat (limited to 'std/math/trunc.zig')
| -rw-r--r-- | std/math/trunc.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/math/trunc.zig b/std/math/trunc.zig index 937a8155e6..01cb1bb84a 100644 --- a/std/math/trunc.zig +++ b/std/math/trunc.zig @@ -9,11 +9,11 @@ const assert = @import("../debug.zig").assert; pub fn trunc(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(trunc32, x), f64 => @inlineCall(trunc64, x), else => @compileError("trunc not implemented for " ++ @typeName(T)), - } + }; } fn trunc32(x: f32) -> f32 { @@ -30,10 +30,10 @@ fn trunc32(x: f32) -> f32 { m = u32(@maxValue(u32)) >> u5(e); if (u & m == 0) { - x + return x; } else { math.forceEval(x + 0x1p120); - @bitCast(f32, u & ~m) + return @bitCast(f32, u & ~m); } } @@ -51,10 +51,10 @@ fn trunc64(x: f64) -> f64 { m = u64(@maxValue(u64)) >> u6(e); if (u & m == 0) { - x + return x; } else { math.forceEval(x + 0x1p120); - @bitCast(f64, u & ~m) + return @bitCast(f64, u & ~m); } } |
