From d917815d8111b98dc237cbe2c723fa63018e02b1 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 22 Dec 2017 00:50:30 -0500 Subject: explicitly return from blocks instead of last statement being expression value closes #629 --- std/math/trunc.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'std/math/trunc.zig') 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); } } -- cgit v1.2.3