mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-31 01:15:17 +01:00
Merge pull request #14146 from jordan-woyak/cached-interp-fix-function-cast-warning
CachedInterpreter: Replace reinterpret_cast with std::bit_cast to resolve -Wcast-function-type-mismatch warnings.
This commit is contained in:
@@ -68,12 +68,12 @@ void CachedInterpreter::ExecuteOneBlock()
|
|||||||
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
|
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
|
||||||
const u8* payload = normal_entry + sizeof(callback);
|
const u8* payload = normal_entry + sizeof(callback);
|
||||||
// Direct dispatch to the most commonly used callbacks for better performance
|
// 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));
|
Interpret<false>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
|
||||||
normal_entry = payload + sizeof(InterpretOperands);
|
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));
|
Interpret<true>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
|
||||||
normal_entry = payload + sizeof(InterpretOperands);
|
normal_entry = payload + sizeof(InterpretOperands);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -33,7 +34,7 @@ protected:
|
|||||||
template <class Operands>
|
template <class Operands>
|
||||||
static AnyCallback AnyCallbackCast(Callback<Operands> callback)
|
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; }
|
static consteval AnyCallback AnyCallbackCast(AnyCallback callback) { return callback; }
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ protected:
|
|||||||
template <class Operands>
|
template <class Operands>
|
||||||
static AnyDisassemble AnyDisassembleCast(Disassemble<Operands> disassemble)
|
static AnyDisassemble AnyDisassembleCast(Disassemble<Operands> disassemble)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<AnyDisassemble>(disassemble);
|
return std::bit_cast<AnyDisassemble>(disassemble);
|
||||||
}
|
}
|
||||||
static consteval AnyDisassemble AnyDisassembleCast(AnyDisassemble disassemble)
|
static consteval AnyDisassemble AnyDisassembleCast(AnyDisassemble disassemble)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user