mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-20 14:57:55 +00:00
[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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user