aboutsummaryrefslogtreecommitdiff
path: root/std/math/trunc.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-25 04:10:11 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-25 04:10:11 -0500
commit3671582c15235e5f79a84936ea2f834f6968ff8c (patch)
tree7fa2c7f06331feaad43ba63b0969add120633d49 /std/math/trunc.zig
parente5bc5873d74713bedbc32817ed31370c3256418d (diff)
downloadzig-3671582c15235e5f79a84936ea2f834f6968ff8c.tar.gz
zig-3671582c15235e5f79a84936ea2f834f6968ff8c.zip
syntax: functions require return type. remove `->`
The purpose of this is: * Only one way to do things * Changing a function with void return type to return a possible error becomes a 1 character change, subtly encouraging people to use errors. See #632 Here are some imperfect sed commands for performing this update: remove arrow: ``` sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig") ``` add void: ``` sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig") ``` Some cleanup may be necessary, but this should do the bulk of the work.
Diffstat (limited to 'std/math/trunc.zig')
-rw-r--r--std/math/trunc.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/std/math/trunc.zig b/std/math/trunc.zig
index 1d9032a22c..54aa6943f7 100644
--- a/std/math/trunc.zig
+++ b/std/math/trunc.zig
@@ -8,7 +8,7 @@ const std = @import("../index.zig");
const math = std.math;
const assert = std.debug.assert;
-pub fn trunc(x: var) -> @typeOf(x) {
+pub fn trunc(x: var) @typeOf(x) {
const T = @typeOf(x);
return switch (T) {
f32 => trunc32(x),
@@ -17,7 +17,7 @@ pub fn trunc(x: var) -> @typeOf(x) {
};
}
-fn trunc32(x: f32) -> f32 {
+fn trunc32(x: f32) f32 {
const u = @bitCast(u32, x);
var e = i32(((u >> 23) & 0xFF)) - 0x7F + 9;
var m: u32 = undefined;
@@ -38,7 +38,7 @@ fn trunc32(x: f32) -> f32 {
}
}
-fn trunc64(x: f64) -> f64 {
+fn trunc64(x: f64) f64 {
const u = @bitCast(u64, x);
var e = i32(((u >> 52) & 0x7FF)) - 0x3FF + 12;
var m: u64 = undefined;