From 992bae4e2a14ca2547c09637b7dc6fc5f73b353a Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 22 Oct 2025 02:56:28 +0200 Subject: [common] replace Common::BitCast with libc++ provided one (#2774) Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2774 Reviewed-by: MaranBr Reviewed-by: crueter Co-authored-by: lizzie Co-committed-by: lizzie --- src/common/CMakeLists.txt | 1 - src/common/bit_cast.h | 23 ----------------------- src/common/overflow.h | 11 +++++------ 3 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 src/common/bit_cast.h (limited to 'src/common') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 2bd74503f4..21f2ab4ed4 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -30,7 +30,6 @@ add_library( assert.h atomic_helpers.h atomic_ops.h - bit_cast.h bit_field.h bit_util.h bounded_threadsafe_queue.h diff --git a/src/common/bit_cast.h b/src/common/bit_cast.h deleted file mode 100644 index c6110c5426..0000000000 --- a/src/common/bit_cast.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include - -#ifdef __cpp_lib_bit_cast -#include -#endif - -namespace Common { - -template -constexpr inline To BitCast(const From& from) { -#ifdef __cpp_lib_bit_cast - return std::bit_cast(from); -#else - return __builtin_bit_cast(To, from); -#endif -} - -} // namespace Common diff --git a/src/common/overflow.h b/src/common/overflow.h index 5f048de7e6..e82747795b 100644 --- a/src/common/overflow.h +++ b/src/common/overflow.h @@ -8,7 +8,8 @@ #include #include -#include "bit_cast.h" +#include +#include namespace Common { @@ -16,11 +17,9 @@ template requires(std::is_integral_v && std::is_signed_v) inline T WrappingAdd(T lhs, T rhs) { using U = std::make_unsigned_t; - - U lhs_u = BitCast(lhs); - U rhs_u = BitCast(rhs); - - return BitCast(lhs_u + rhs_u); + U lhs_u = std::bit_cast(lhs); + U rhs_u = std::bit_cast(rhs); + return std::bit_cast(lhs_u + rhs_u); } template -- cgit v1.2.3