Commit 887c97742f

Marc Tiehuis <marctiehuis@gmail.com>
2018-06-30 10:15:02
Alignment fix and allow rudimentary f128 float printing
1 parent 951512f
Changed files (2)
std
fmt
special
compiler_rt
std/fmt/index.zig
@@ -327,7 +327,7 @@ pub fn formatFloatScientific(
     comptime Errors: type,
     output: fn (@typeOf(context), []const u8) Errors!void,
 ) Errors!void {
-    var x = f64(value);
+    var x = @floatCast(f64, value);
 
     // Errol doesn't handle these special cases.
     if (math.signbit(x)) {
std/special/compiler_rt/floatunditf.zig
@@ -17,7 +17,7 @@ pub extern fn __floatunditf(a: u128) f128 {
     const exp = (u128.bit_count - 1) - @clz(a);
     const shift = mantissa_bits - @intCast(u7, exp);
 
-    var result: u128 = (a << shift) ^ implicit_bit;
+    var result: u128 align(16) = (a << shift) ^ implicit_bit;
     result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits;
 
     return @bitCast(f128, result);