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/round.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/round.zig')
| -rw-r--r-- | std/math/round.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/math/round.zig b/std/math/round.zig index a16bedc3f5..8e604d1b68 100644 --- a/std/math/round.zig +++ b/std/math/round.zig @@ -10,11 +10,11 @@ const math = @import("index.zig"); pub fn round(x: var) -> @typeOf(x) { const T = @typeOf(x); - switch (T) { + return switch (T) { f32 => @inlineCall(round32, x), f64 => @inlineCall(round64, x), else => @compileError("round not implemented for " ++ @typeName(T)), - } + }; } fn round32(x_: f32) -> f32 { @@ -48,9 +48,9 @@ fn round32(x_: f32) -> f32 { } if (u >> 31 != 0) { - -y + return -y; } else { - y + return y; } } @@ -85,9 +85,9 @@ fn round64(x_: f64) -> f64 { } if (u >> 63 != 0) { - -y + return -y; } else { - y + return y; } } |
