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/ceil.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/ceil.zig')
| -rw-r--r-- | std/math/ceil.zig | 16 |
1 files changed, 8 insertions, 8 deletions
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; } } |
