commit fb7a95b3c458457c12c47f6dabaeb37cb3bf85b2 (tree)
parent dc084128954b99f93a0d974c3e5ed8347e9f1e8a
Author: MovingtoMars <liam@bumblebee.net.nz>
Date: Thu, 28 Jan 2016 19:43:08 +1300
cleanup float printing
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/std/std.zig b/std/std.zig
@@ -246,15 +246,15 @@ pub fn buf_print_u64(out_buf: []u8, x: u64) -> isize {
pub fn buf_print_f64(out_buf: []u8, x: f64) -> isize {
if (x == f64_get_pos_inf()) {
const buf2 = "+Inf";
- @memcpy(&out_buf[0], &buf2[0], 4);
+ @memcpy(&out_buf[0], &buf2[0], buf2.len);
return 4;
} else if (x == f64_get_neg_inf()) {
const buf2 = "-Inf";
- @memcpy(&out_buf[0], &buf2[0], 4);
+ @memcpy(&out_buf[0], &buf2[0], buf2.len);
return 4;
} else if (f64_is_nan(x)) {
const buf2 = "NaN";
- @memcpy(&out_buf[0], &buf2[0], 3);
+ @memcpy(&out_buf[0], &buf2[0], buf2.len);
return 3;
}