[common] replace Common::BitCast with libc++ provided one (#2774)

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2774
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-10-22 02:56:28 +02:00 committed by crueter
parent 6ff043c4fb
commit 992bae4e2a
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
25 changed files with 152 additions and 151 deletions

View file

@ -8,7 +8,8 @@
#include <algorithm>
#include <type_traits>
#include "bit_cast.h"
#include <numeric>
#include <bit>
namespace Common {
@ -16,11 +17,9 @@ template <typename T>
requires(std::is_integral_v<T> && std::is_signed_v<T>)
inline T WrappingAdd(T lhs, T rhs) {
using U = std::make_unsigned_t<T>;
U lhs_u = BitCast<U>(lhs);
U rhs_u = BitCast<U>(rhs);
return BitCast<T>(lhs_u + rhs_u);
U lhs_u = std::bit_cast<U>(lhs);
U rhs_u = std::bit_cast<U>(rhs);
return std::bit_cast<T>(lhs_u + rhs_u);
}
template <typename T>