aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread/Futex.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-19 22:36:24 -0700
committerGitHub <noreply@github.com>2023-06-19 22:36:24 -0700
commita72d634b731952ee227d026c27e83c5702dcea4a (patch)
tree8bfc4c9afa75a27ebb1108924589a8e7d5cc89ed /lib/std/Thread/Futex.zig
parentc6e2e1ae4b85fc36acc89c9a5e2673834146d628 (diff)
parenta4d1edac8d65e1aa4b565f6fb11ab78541d97efa (diff)
downloadzig-a72d634b731952ee227d026c27e83c5702dcea4a.tar.gz
zig-a72d634b731952ee227d026c27e83c5702dcea4a.zip
Merge pull request #16046 from BratishkaErik/issue-6128
Renaming `@xtoy` to `@YfromX`
Diffstat (limited to 'lib/std/Thread/Futex.zig')
-rw-r--r--lib/std/Thread/Futex.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig
index 7fbe49fea2..61e39eba27 100644
--- a/lib/std/Thread/Futex.zig
+++ b/lib/std/Thread/Futex.zig
@@ -202,7 +202,7 @@ const DarwinImpl = struct {
};
if (status >= 0) return;
- switch (@intToEnum(std.os.E, -status)) {
+ switch (@enumFromInt(std.os.E, -status)) {
// Wait was interrupted by the OS or other spurious signalling.
.INTR => {},
// Address of the futex was paged out. This is unlikely, but possible in theory, and
@@ -229,7 +229,7 @@ const DarwinImpl = struct {
const status = os.darwin.__ulock_wake(flags, addr, 0);
if (status >= 0) return;
- switch (@intToEnum(std.os.E, -status)) {
+ switch (@enumFromInt(std.os.E, -status)) {
.INTR => continue, // spurious wake()
.FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t
.NOENT => return, // nothing was woken up
@@ -304,11 +304,11 @@ const FreebsdImpl = struct {
}
const rc = os.freebsd._umtx_op(
- @ptrToInt(&ptr.value),
- @enumToInt(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE),
+ @intFromPtr(&ptr.value),
+ @intFromEnum(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE),
@as(c_ulong, expect),
tm_size,
- @ptrToInt(tm_ptr),
+ @intFromPtr(tm_ptr),
);
switch (os.errno(rc)) {
@@ -326,8 +326,8 @@ const FreebsdImpl = struct {
fn wake(ptr: *const Atomic(u32), max_waiters: u32) void {
const rc = os.freebsd._umtx_op(
- @ptrToInt(&ptr.value),
- @enumToInt(os.freebsd.UMTX_OP.WAKE_PRIVATE),
+ @intFromPtr(&ptr.value),
+ @intFromEnum(os.freebsd.UMTX_OP.WAKE_PRIVATE),
@as(c_ulong, max_waiters),
0, // there is no timeout struct
0, // there is no timeout struct pointer
@@ -719,7 +719,7 @@ const PosixImpl = struct {
// Make sure the pointer is aligned,
// then cut off the zero bits from the alignment to get the unique address.
- const addr = @ptrToInt(ptr);
+ const addr = @intFromPtr(ptr);
assert(addr & (alignment - 1) == 0);
return addr >> @ctz(@as(usize, alignment));
}