update the codebase to use @as

This commit is contained in:
Andrew Kelley
2019-11-06 23:25:57 -05:00
parent 2a6fbbd8fb
commit e0db54e89d
206 changed files with 1287 additions and 1282 deletions

View File

@@ -122,7 +122,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\
\\pub fn main() void {
\\ const stdout = &(io.getStdOut() catch unreachable).outStream().stream;
\\ stdout.print("Hello, world!\n{d:4} {x:3} {c}\n", u32(12), u16(0x12), u8('a')) catch unreachable;
\\ stdout.print("Hello, world!\n{d:4} {x:3} {c}\n", @as(u32, 12), @as(u16, 0x12), @as(u8, 'a')) catch unreachable;
\\}
, "Hello, world!\n 12 12 a\n");
@@ -166,54 +166,54 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ _ = c.printf(c"\n");
\\
\\ _ = c.printf(c"0.0: %.013a\n",
\\ f64(0.0));
\\ @as(f64, 0.0));
\\ _ = c.printf(c"0e0: %.013a\n",
\\ f64(0e0));
\\ @as(f64, 0e0));
\\ _ = c.printf(c"0.0e0: %.013a\n",
\\ f64(0.0e0));
\\ @as(f64, 0.0e0));
\\ _ = c.printf(c"000000000000000000000000000000000000000000000000000000000.0e0: %.013a\n",
\\ f64(000000000000000000000000000000000000000000000000000000000.0e0));
\\ @as(f64, 000000000000000000000000000000000000000000000000000000000.0e0));
\\ _ = c.printf(c"0.000000000000000000000000000000000000000000000000000000000e0: %.013a\n",
\\ f64(0.000000000000000000000000000000000000000000000000000000000e0));
\\ @as(f64, 0.000000000000000000000000000000000000000000000000000000000e0));
\\ _ = c.printf(c"0.0e000000000000000000000000000000000000000000000000000000000: %.013a\n",
\\ f64(0.0e000000000000000000000000000000000000000000000000000000000));
\\ @as(f64, 0.0e000000000000000000000000000000000000000000000000000000000));
\\ _ = c.printf(c"1.0: %.013a\n",
\\ f64(1.0));
\\ @as(f64, 1.0));
\\ _ = c.printf(c"10.0: %.013a\n",
\\ f64(10.0));
\\ @as(f64, 10.0));
\\ _ = c.printf(c"10.5: %.013a\n",
\\ f64(10.5));
\\ @as(f64, 10.5));
\\ _ = c.printf(c"10.5e5: %.013a\n",
\\ f64(10.5e5));
\\ @as(f64, 10.5e5));
\\ _ = c.printf(c"10.5e+5: %.013a\n",
\\ f64(10.5e+5));
\\ @as(f64, 10.5e+5));
\\ _ = c.printf(c"50.0e-2: %.013a\n",
\\ f64(50.0e-2));
\\ @as(f64, 50.0e-2));
\\ _ = c.printf(c"50e-2: %.013a\n",
\\ f64(50e-2));
\\ @as(f64, 50e-2));
\\
\\ _ = c.printf(c"\n");
\\
\\ _ = c.printf(c"0x1.0: %.013a\n",
\\ f64(0x1.0));
\\ @as(f64, 0x1.0));
\\ _ = c.printf(c"0x10.0: %.013a\n",
\\ f64(0x10.0));
\\ @as(f64, 0x10.0));
\\ _ = c.printf(c"0x100.0: %.013a\n",
\\ f64(0x100.0));
\\ @as(f64, 0x100.0));
\\ _ = c.printf(c"0x103.0: %.013a\n",
\\ f64(0x103.0));
\\ @as(f64, 0x103.0));
\\ _ = c.printf(c"0x103.7: %.013a\n",
\\ f64(0x103.7));
\\ @as(f64, 0x103.7));
\\ _ = c.printf(c"0x103.70: %.013a\n",
\\ f64(0x103.70));
\\ @as(f64, 0x103.70));
\\ _ = c.printf(c"0x103.70p4: %.013a\n",
\\ f64(0x103.70p4));
\\ @as(f64, 0x103.70p4));
\\ _ = c.printf(c"0x103.70p5: %.013a\n",
\\ f64(0x103.70p5));
\\ @as(f64, 0x103.70p5));
\\ _ = c.printf(c"0x103.70p+5: %.013a\n",
\\ f64(0x103.70p+5));
\\ @as(f64, 0x103.70p+5));
\\ _ = c.printf(c"0x103.70p-5: %.013a\n",
\\ f64(0x103.70p-5));
\\ @as(f64, 0x103.70p-5));
\\
\\ return 0;
\\}
@@ -323,7 +323,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ const x: f64 = small;
\\ const y = @floatToInt(i32, x);
\\ const z = @intToFloat(f64, y);
\\ _ = c.printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4));
\\ _ = c.printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, @as(f64, -0.4));
\\ return 0;
\\}
, "3.25\n3\n3.00\n-0.40\n");