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/ceil.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'std/math/ceil.zig') diff --git a/std/math/ceil.zig b/std/math/ceil.zig index 2c7b28cc93..a8db486f92 100644 --- a/std/math/ceil.zig +++ b/std/math/ceil.zig @@ -10,11 +10,11 @@ const assert = @import("../debug.zig").assert; pub fn ceil(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(ceil32, x), f64 => @inlineCall(ceil64, x), else => @compileError("ceil not implemented for " ++ @typeName(T)), - } + }; } fn ceil32(x: f32) -> f32 { @@ -39,13 +39,13 @@ fn ceil32(x: f32) -> f32 { u += m; } u &= ~m; - @bitCast(f32, u) + return @bitCast(f32, u); } else { math.forceEval(x + 0x1.0p120); if (u >> 31 != 0) { return -0.0; } else { - 1.0 + return 1.0; } } } @@ -70,14 +70,14 @@ fn ceil64(x: f64) -> f64 { if (e <= 0x3FF-1) { math.forceEval(y); if (u >> 63 != 0) { - return -0.0; // Compiler requires return. + return -0.0; } else { - 1.0 + return 1.0; } } else if (y < 0) { - x + y + 1 + return x + y + 1; } else { - x + y + return x + y; } } -- cgit v1.2.3