mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-14 19:59:01 +02: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:
parent
6ff043c4fb
commit
992bae4e2a
25 changed files with 152 additions and 151 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue