mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
fmt_unveil<> fix
This commit is contained in:
parent
4438163da1
commit
1a7ea2d235
@ -944,13 +944,12 @@ template<typename T> using atomic_be_t = atomic_t<be_t<T>>;
|
||||
template<typename T> using atomic_le_t = atomic_t<le_t<T>>;
|
||||
#endif
|
||||
|
||||
// Formatting for BE/LE data
|
||||
template<typename T, bool Se, std::size_t Align>
|
||||
struct fmt_unveil<se_t<T, Se, Align>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<T>::type;
|
||||
|
||||
static inline u64 get(const se_t<T, Se, Align>& arg)
|
||||
static inline auto get(const se_t<T, Se, Align>& arg)
|
||||
{
|
||||
return fmt_unveil<T>::get(arg);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ struct fmt_unveil<bf_t<T, I, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<T>>::type;
|
||||
|
||||
static inline u64 get(const bf_t<T, I, N>& bf)
|
||||
static inline auto get(const bf_t<T, I, N>& bf)
|
||||
{
|
||||
return fmt_unveil<type>::get(bf);
|
||||
}
|
||||
@ -259,7 +259,7 @@ struct fmt_unveil<cf_t<F, Fields...>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<typename F::type>>::type;
|
||||
|
||||
static inline u64 get(const cf_t<F, Fields...>& cf)
|
||||
static inline auto get(const cf_t<F, Fields...>& cf)
|
||||
{
|
||||
return fmt_unveil<type>::get(cf);
|
||||
}
|
||||
@ -270,7 +270,7 @@ struct fmt_unveil<ff_t<T, V, N>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<simple_t<T>>::type;
|
||||
|
||||
static inline u64 get(const ff_t<T, V, N>& ff)
|
||||
static inline auto get(const ff_t<T, V, N>& ff)
|
||||
{
|
||||
return fmt_unveil<type>::get(ff);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ struct fmt_unveil<bitset_t<T, BitSize>, void>
|
||||
{
|
||||
using type = typename bitset_t<T, BitSize>::raw_type;
|
||||
|
||||
static inline u64 get(const bitset_t<T, BitSize>& value)
|
||||
static inline auto get(const bitset_t<T, BitSize>& value)
|
||||
{
|
||||
return fmt_unveil<type>::get(static_cast<type>(value._value()));
|
||||
}
|
||||
|
@ -314,14 +314,8 @@ namespace cfg
|
||||
|
||||
if (try_to_enum_value(&result, &fmt_class_string<T>::format, value))
|
||||
{
|
||||
const auto val = static_cast<std::underlying_type_t<T>>(result);
|
||||
|
||||
if (static_cast<u64>(val) != result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_value = static_cast<T>(val);
|
||||
// No narrowing check, it's hard to do right there
|
||||
m_value = static_cast<T>(static_cast<std::underlying_type_t<T>>(result));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "Platform.h"
|
||||
#include "types.h"
|
||||
@ -23,6 +24,24 @@ struct fmt_unveil
|
||||
{
|
||||
return reinterpret_cast<std::uintptr_t>(&arg);
|
||||
}
|
||||
|
||||
// Temporary value container (can possibly be created by other fmt_unveil<> specializations)
|
||||
struct u64_wrapper
|
||||
{
|
||||
T arg;
|
||||
|
||||
// Allow implicit conversion
|
||||
operator u64() const
|
||||
{
|
||||
return reinterpret_cast<std::uintptr_t>(&arg);
|
||||
}
|
||||
};
|
||||
|
||||
// This overload resolution takes the precedence
|
||||
static inline u64_wrapper get(T&& arg)
|
||||
{
|
||||
return {std::move(arg)};
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -1026,7 +1026,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
||||
{
|
||||
if (op == X64OP_NONE)
|
||||
{
|
||||
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): unsupported opcode found (%016llX%016llX)", code, *(be_t<u64>*)(code), *(be_t<u64>*)(code + 8));
|
||||
LOG_ERROR(MEMORY, "decode_x64_reg_op(%ph): unsupported opcode: %s", code, *(be_t<v128, 1>*)(code));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -529,7 +529,7 @@ struct fmt_unveil<id_value<T, ID>>
|
||||
{
|
||||
using type = typename fmt_unveil<ID>::type;
|
||||
|
||||
static inline u64 get(const id_value<T, ID>& value)
|
||||
static inline auto get(const id_value<T, ID>& value)
|
||||
{
|
||||
return fmt_unveil<ID>::get(value);
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ struct fmt_unveil<vm::_ptr_base<T, AT>, void>
|
||||
{
|
||||
using type = typename fmt_unveil<AT>::type;
|
||||
|
||||
static inline u64 get(const vm::_ptr_base<T, AT>& arg)
|
||||
static inline auto get(const vm::_ptr_base<T, AT>& arg)
|
||||
{
|
||||
return fmt_unveil<AT>::get(arg.addr());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user