From 4a89300929b470cacc0391719b9c29ac740a33f2 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 20 Nov 2025 03:12:59 -0600 Subject: [PATCH] CachedInterpreter: Replace reinterpret_cast with std::bit_cast to resolve -Wcast-function-type-mismatch warnings. --- .../Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp | 4 ++-- .../PowerPC/CachedInterpreter/CachedInterpreterEmitter.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp index a8733b91b60..e8cde761d8a 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp @@ -68,12 +68,12 @@ void CachedInterpreter::ExecuteOneBlock() const auto callback = *reinterpret_cast(normal_entry); const u8* payload = normal_entry + sizeof(callback); // Direct dispatch to the most commonly used callbacks for better performance - if (callback == reinterpret_cast(CallbackCast(Interpret))) [[likely]] + if (callback == AnyCallbackCast(Interpret)) [[likely]] { Interpret(ppc_state, *reinterpret_cast(payload)); normal_entry = payload + sizeof(InterpretOperands); } - else if (callback == reinterpret_cast(CallbackCast(Interpret))) + else if (callback == AnyCallbackCast(Interpret)) { Interpret(ppc_state, *reinterpret_cast(payload)); normal_entry = payload + sizeof(InterpretOperands); diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreterEmitter.h b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreterEmitter.h index 7b1554ffc10..9a07cc61d59 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreterEmitter.h +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreterEmitter.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include #include @@ -33,7 +34,7 @@ protected: template static AnyCallback AnyCallbackCast(Callback callback) { - return reinterpret_cast(callback); + return std::bit_cast(callback); } static consteval AnyCallback AnyCallbackCast(AnyCallback callback) { return callback; } @@ -45,7 +46,7 @@ protected: template static AnyDisassemble AnyDisassembleCast(Disassemble disassemble) { - return reinterpret_cast(disassemble); + return std::bit_cast(disassemble); } static consteval AnyDisassemble AnyDisassembleCast(AnyDisassemble disassemble) {