From 72af04044d206e3f17fd72d20e152d9532be4924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Thu, 28 Nov 2024 20:51:15 -0800 Subject: [PATCH] Cleanup. --- src/thread.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/thread.cpp b/src/thread.cpp index 94cb2a4e3..8117f19cd 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -83,13 +83,8 @@ namespace bx void* ThreadInternal::threadFunc(void* _arg) { Thread* thread = (Thread*)_arg; - union - { - void* ptr; - int32_t i; - } cast; - cast.i = thread->entry(); - return cast.ptr; + intptr_t result = thread->entry(); + return bitCast(result); } #endif // BX_PLATFORM_ @@ -219,13 +214,9 @@ namespace bx CloseHandle(ti->m_handle); ti->m_handle = INVALID_HANDLE_VALUE; #elif BX_PLATFORM_POSIX - union - { - void* ptr; - int32_t i; - } cast; - pthread_join(ti->m_handle, &cast.ptr); - m_exitCode = cast.i; + void* ptr; + pthread_join(ti->m_handle, &ptr); + m_exitCode = narrowCast(bitCast(ptr) ); ti->m_handle = 0; #endif // BX_PLATFORM_