[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,8 +8,8 @@
#include <functional>
#include <tuple>
#include <type_traits>
#include "common/bit_cast.h"
#include <bit>
#include <numeric>
#include "shader_recompiler/environment.h"
#include "shader_recompiler/exception.h"
#include "shader_recompiler/frontend/ir/ir_emitter.h"
@ -536,7 +536,7 @@ template <IR::Opcode op, typename Dest, typename Source>
void FoldBitCast(IR::Inst& inst, IR::Opcode reverse) {
const IR::Value value{inst.Arg(0)};
if (value.IsImmediate()) {
inst.ReplaceUsesWith(IR::Value{Common::BitCast<Dest>(Arg<Source>(value))});
inst.ReplaceUsesWith(IR::Value{std::bit_cast<Dest>(Arg<Source>(value))});
return;
}
IR::Inst* const arg_inst{value.InstRecursive()};
@ -674,7 +674,7 @@ void FoldFSwizzleAdd(IR::Block& block, IR::Inst& inst) {
if (!value_2.IsImmediate() || !value_3.IsImmediate()) {
return;
}
if (Common::BitCast<u32>(value_2.F32()) != value_3.U32()) {
if (std::bit_cast<u32>(value_2.F32()) != value_3.U32()) {
return;
}
}
@ -821,7 +821,7 @@ bool FindGradient3DDerivatives(std::array<IR::Value, 3>& results, IR::Value coor
void ConvertDerivatives(std::array<IR::Value, 3>& results, IR::IREmitter& ir) {
for (size_t i = 0; i < 3; i++) {
if (results[i].Type() == IR::Type::U32) {
results[i] = results[i].IsImmediate() ? ir.Imm32(Common::BitCast<f32>(results[i].U32()))
results[i] = results[i].IsImmediate() ? ir.Imm32(std::bit_cast<f32>(results[i].U32()))
: ir.BitCast<IR::F32>(IR::U32(results[i]));
}
}
@ -927,7 +927,7 @@ void FoldDriverConstBuffer(Environment& env, IR::Block& block, IR::Inst& inst, u
inst.ReplaceUsesWith(IR::Value{env.ReadCbufValue(bank_value, offset_value)});
} else {
inst.ReplaceUsesWith(
IR::Value{Common::BitCast<f32>(env.ReadCbufValue(bank_value, offset_value))});
IR::Value{std::bit_cast<f32>(env.ReadCbufValue(bank_value, offset_value))});
}
}