commit 34aac2bae145ae19fcbe36f794ee7054ea4de11f (tree)
parent 825da34769784c7bdfa0d6be325c7299d992a951
Author: XXIV <13811862+thechampagne@users.noreply.github.com>
Date: Tue, 31 Oct 2023 07:17:39 +0300
std/Thread: remove unnecessary `@ptrCast` (#17766)
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
@@ -552,7 +552,7 @@ const WindowsThreadImpl = struct {
null,
stack_size,
Instance.entryFn,
- @as(*anyopaque, @ptrCast(instance)),
+ instance,
0,
null,
) orelse {
diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig
@@ -136,8 +136,8 @@ const WindowsImpl = struct {
}
const rc = os.windows.ntdll.RtlWaitOnAddress(
- @as(?*const anyopaque, @ptrCast(ptr)),
- @as(?*const anyopaque, @ptrCast(&expect)),
+ ptr,
+ &expect,
@sizeOf(@TypeOf(expect)),
timeout_ptr,
);
@@ -153,7 +153,7 @@ const WindowsImpl = struct {
}
fn wake(ptr: *const Atomic(u32), max_waiters: u32) void {
- const address = @as(?*const anyopaque, @ptrCast(ptr));
+ const address: ?*const anyopaque = ptr;
assert(max_waiters != 0);
switch (max_waiters) {
@@ -188,7 +188,7 @@ const DarwinImpl = struct {
// true so that we we know to ignore the ETIMEDOUT result.
var timeout_overflowed = false;
- const addr = @as(*const anyopaque, @ptrCast(ptr));
+ const addr: *const anyopaque = ptr;
const flags = os.darwin.UL_COMPARE_AND_WAIT | os.darwin.ULF_NO_ERRNO;
const status = blk: {
if (supports_ulock_wait2) {
@@ -227,7 +227,7 @@ const DarwinImpl = struct {
}
while (true) {
- const addr = @as(*const anyopaque, @ptrCast(ptr));
+ const addr: *const anyopaque = ptr;
const status = os.darwin.__ulock_wake(flags, addr, 0);
if (status >= 0) return;