zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ea4d2759a51f2805e8345fe85500feefef3f504c (tree)
parent 6de8b4bc3d105c15cd473c5bf100db4c9328dd54
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue, 15 Mar 2022 17:04:23 -0400

Merge pull request #11180 from jmc-88/cbe3

CBE: amending an incorrect test name, plus two small fixes
Diffstat:
Msrc/codegen/c.zig | 2+-
Msrc/link/C/zig.h | 2++
Mtest/behavior/bugs/2114.zig | 6+++---
3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -2541,7 +2541,7 @@ fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: [*:0]const u8) !CValu try f.writeCValue(writer, lhs); try writer.print("{s}", .{operator}); try f.writeCValue(writer, rhs); - try writer.writeAll(") "); + try writer.writeAll(") ? "); try f.writeCValue(writer, lhs); try writer.writeAll(" : "); try f.writeCValue(writer, rhs); diff --git a/src/link/C/zig.h b/src/link/C/zig.h @@ -1,3 +1,5 @@ +#undef linux + #if __STDC_VERSION__ >= 201112L #define zig_noreturn _Noreturn #define zig_threadlocal thread_local diff --git a/test/behavior/bugs/2114.zig b/test/behavior/bugs/2114.zig @@ -7,11 +7,11 @@ fn ctz(x: anytype) usize { } test "fixed" { - try testClz(); - comptime try testClz(); + try testCtz(); + comptime try testCtz(); } -fn testClz() !void { +fn testCtz() !void { try expect(ctz(@as(u128, 0x40000000000000000000000000000000)) == 126); try expect(math.rotl(u128, @as(u128, 0x40000000000000000000000000000000), @as(u8, 1)) == @as(u128, 0x80000000000000000000000000000000)); try expect(ctz(@as(u128, 0x80000000000000000000000000000000)) == 127);