diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-06-19 22:36:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-19 22:36:24 -0700 |
| commit | a72d634b731952ee227d026c27e83c5702dcea4a (patch) | |
| tree | 8bfc4c9afa75a27ebb1108924589a8e7d5cc89ed /lib/std/atomic | |
| parent | c6e2e1ae4b85fc36acc89c9a5e2673834146d628 (diff) | |
| parent | a4d1edac8d65e1aa4b565f6fb11ab78541d97efa (diff) | |
| download | zig-a72d634b731952ee227d026c27e83c5702dcea4a.tar.gz zig-a72d634b731952ee227d026c27e83c5702dcea4a.zip | |
Merge pull request #16046 from BratishkaErik/issue-6128
Renaming `@xtoy` to `@YfromX`
Diffstat (limited to 'lib/std/atomic')
| -rw-r--r-- | lib/std/atomic/Atomic.zig | 6 | ||||
| -rw-r--r-- | lib/std/atomic/queue.zig | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/atomic/Atomic.zig b/lib/std/atomic/Atomic.zig index 6c0c477725..81918638b5 100644 --- a/lib/std/atomic/Atomic.zig +++ b/lib/std/atomic/Atomic.zig @@ -227,7 +227,7 @@ pub fn Atomic(comptime T: type) type { .Toggle => self.fetchXor(mask, ordering), }; - return @boolToInt(value & mask != 0); + return @intFromBool(value & mask != 0); } inline fn x86BitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 { @@ -392,8 +392,8 @@ test "Atomic.swap" { try testing.expectEqual(a.load(.SeqCst), true); var b = Atomic(?*u8).init(null); - try testing.expectEqual(b.swap(@intToPtr(?*u8, @alignOf(u8)), ordering), null); - try testing.expectEqual(b.load(.SeqCst), @intToPtr(?*u8, @alignOf(u8))); + try testing.expectEqual(b.swap(@ptrFromInt(?*u8, @alignOf(u8)), ordering), null); + try testing.expectEqual(b.load(.SeqCst), @ptrFromInt(?*u8, @alignOf(u8))); } } diff --git a/lib/std/atomic/queue.zig b/lib/std/atomic/queue.zig index 7c9ffa2684..70cb293cf4 100644 --- a/lib/std/atomic/queue.zig +++ b/lib/std/atomic/queue.zig @@ -135,7 +135,7 @@ pub fn Queue(comptime T: type) type { ) !void { try s.writeByteNTimes(' ', indent); if (optional_node) |node| { - try s.print("0x{x}={}\n", .{ @ptrToInt(node), node.data }); + try s.print("0x{x}={}\n", .{ @intFromPtr(node), node.data }); if (depth == 0) { try s.print("(max depth)\n", .{}); return; @@ -387,7 +387,7 @@ test "std.atomic.Queue dump" { \\tail: 0x{x}=1 \\ (null) \\ - , .{ @ptrToInt(queue.head), @ptrToInt(queue.tail) }); + , .{ @intFromPtr(queue.head), @intFromPtr(queue.tail) }); try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); // Test a stream with two elements @@ -408,6 +408,6 @@ test "std.atomic.Queue dump" { \\tail: 0x{x}=2 \\ (null) \\ - , .{ @ptrToInt(queue.head), @ptrToInt(queue.head.?.next), @ptrToInt(queue.tail) }); + , .{ @intFromPtr(queue.head), @intFromPtr(queue.head.?.next), @intFromPtr(queue.tail) }); try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); } |
