This commit is contained in:
Jordan Woyak 2025-12-15 17:14:35 -06:00 committed by GitHub
commit 6331db73e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -68,12 +68,12 @@ void CachedInterpreter::ExecuteOneBlock()
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
const u8* payload = normal_entry + sizeof(callback);
// Direct dispatch to the most commonly used callbacks for better performance
if (callback == reinterpret_cast<AnyCallback>(CallbackCast(Interpret<false>))) [[likely]]
if (callback == AnyCallbackCast(Interpret<false>)) [[likely]]
{
Interpret<false>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
normal_entry = payload + sizeof(InterpretOperands);
}
else if (callback == reinterpret_cast<AnyCallback>(CallbackCast(Interpret<true>)))
else if (callback == AnyCallbackCast(Interpret<true>))
{
Interpret<true>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
normal_entry = payload + sizeof(InterpretOperands);

View File

@ -3,6 +3,7 @@
#pragma once
#include <bit>
#include <cstddef>
#include <iosfwd>
#include <type_traits>
@ -33,7 +34,7 @@ protected:
template <class Operands>
static AnyCallback AnyCallbackCast(Callback<Operands> callback)
{
return reinterpret_cast<AnyCallback>(callback);
return std::bit_cast<AnyCallback>(callback);
}
static consteval AnyCallback AnyCallbackCast(AnyCallback callback) { return callback; }
@ -45,7 +46,7 @@ protected:
template <class Operands>
static AnyDisassemble AnyDisassembleCast(Disassemble<Operands> disassemble)
{
return reinterpret_cast<AnyDisassemble>(disassemble);
return std::bit_cast<AnyDisassemble>(disassemble);
}
static consteval AnyDisassemble AnyDisassembleCast(AnyDisassemble disassemble)
{