mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 19:22:48 +01:00
More constexpr
This commit is contained in:
parent
0bb83ed5e9
commit
29901d65ed
@ -689,7 +689,7 @@ struct fmt::cfmt_src
|
||||
TYPE(llong);
|
||||
TYPE(schar);
|
||||
TYPE(short);
|
||||
if (std::is_signed_v<char>) TYPE(char);
|
||||
if constexpr (std::is_signed_v<char>) TYPE(char);
|
||||
TYPE(long);
|
||||
TYPE(s128);
|
||||
|
||||
|
@ -16,7 +16,7 @@ bool music_selection_context::set(const CellMusicSelectionContext& in)
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 pos = sizeof(magic);
|
||||
constexpr u32 pos = sizeof(magic);
|
||||
hash = &in.data[pos];
|
||||
|
||||
return load_playlist();
|
||||
|
@ -92,21 +92,21 @@ namespace ppu_cb_detail
|
||||
template<u32 g_count, u32 f_count, u32 v_count, typename T1, typename... T>
|
||||
FORCE_INLINE static bool _bind_func_args(ppu_thread& CPU, T1 arg1, T... args)
|
||||
{
|
||||
const bool is_float = std::is_floating_point_v<T1>;
|
||||
const bool is_vector = std::is_same_v<std::decay_t<T1>, v128>;
|
||||
const bool is_context = std::is_same_v<std::decay_t<T1>, ppu_thread>;
|
||||
const bool is_general = !is_float && !is_vector && !is_context;
|
||||
constexpr bool is_float = std::is_floating_point_v<T1>;
|
||||
constexpr bool is_vector = std::is_same_v<std::decay_t<T1>, v128>;
|
||||
constexpr bool is_context = std::is_same_v<std::decay_t<T1>, ppu_thread>;
|
||||
constexpr bool is_general = !is_float && !is_vector && !is_context;
|
||||
|
||||
const _func_arg_type t =
|
||||
constexpr _func_arg_type t =
|
||||
is_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) :
|
||||
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
||||
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
||||
is_context ? ARG_CONTEXT :
|
||||
ARG_UNKNOWN;
|
||||
|
||||
const u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||
const u32 f = f_count + is_float;
|
||||
const u32 v = v_count + is_vector;
|
||||
constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||
constexpr u32 f = f_count + is_float;
|
||||
constexpr u32 v = v_count + is_vector;
|
||||
|
||||
_func_arg<T1, t, g, f, v>::set_value(CPU, arg1);
|
||||
|
||||
@ -157,9 +157,9 @@ namespace ppu_cb_detail
|
||||
|
||||
static_assert(!std::is_pointer_v<RT>, "Invalid callback result type (pointer)");
|
||||
static_assert(!std::is_reference_v<RT>, "Invalid callback result type (reference)");
|
||||
const bool is_float = std::is_floating_point_v<RT>;
|
||||
const bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
||||
const _func_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||
constexpr bool is_float = std::is_floating_point_v<RT>;
|
||||
constexpr bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
||||
constexpr _func_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||
|
||||
return _func_res<RT, t>::get_value(CPU);
|
||||
}
|
||||
|
@ -192,13 +192,13 @@ namespace ppu_func_detail
|
||||
const u32 v_count = (info.last_value >> 24);
|
||||
|
||||
// TODO: check calculations
|
||||
const bool is_float = std::is_floating_point_v<T>;
|
||||
const bool is_vector = std::is_same_v<std::decay_t<T>, v128>;
|
||||
const bool is_context = std::is_base_of_v<std::decay_t<T>, ppu_thread>;
|
||||
const bool is_variadic = std::is_same_v<std::decay_t<T>, ppu_va_args_t>;
|
||||
const bool is_general = !is_float && !is_vector && !is_context && !is_variadic;
|
||||
constexpr bool is_float = std::is_floating_point_v<T>;
|
||||
constexpr bool is_vector = std::is_same_v<std::decay_t<T>, v128>;
|
||||
constexpr bool is_context = std::is_base_of_v<std::decay_t<T>, ppu_thread>;
|
||||
constexpr bool is_variadic = std::is_same_v<std::decay_t<T>, ppu_va_args_t>;
|
||||
constexpr bool is_general = !is_float && !is_vector && !is_context && !is_variadic;
|
||||
|
||||
const arg_class t =
|
||||
constexpr arg_class t =
|
||||
is_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) :
|
||||
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
||||
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
||||
@ -206,9 +206,9 @@ namespace ppu_func_detail
|
||||
is_variadic ? ARG_VARIADIC :
|
||||
ARG_UNKNOWN;
|
||||
|
||||
const u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||
const u32 f = f_count + is_float;
|
||||
const u32 v = v_count + is_vector;
|
||||
constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||
constexpr u32 f = f_count + is_float;
|
||||
constexpr u32 v = v_count + is_vector;
|
||||
|
||||
return call<Types...>(ppu, func, arg_info_pack_t<Info..., t | (g << 8) | (f << 16) | (v << 24)>{});
|
||||
}
|
||||
@ -218,9 +218,9 @@ namespace ppu_func_detail
|
||||
{
|
||||
static_assert(!std::is_pointer_v<RT>, "Invalid function result type (pointer)");
|
||||
static_assert(!std::is_reference_v<RT>, "Invalid function result type (reference)");
|
||||
static const bool is_float = std::is_floating_point_v<RT>;
|
||||
static const bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
||||
static const arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||
static constexpr bool is_float = std::is_floating_point_v<RT>;
|
||||
static constexpr bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
||||
static constexpr arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||
};
|
||||
|
||||
template<typename RT, typename... T> struct func_binder;
|
||||
|
@ -568,7 +568,7 @@ namespace
|
||||
*/
|
||||
|
||||
// <= 128 so fits in u8
|
||||
u8 block_size_in_bytes = sizeof(SRC_TYPE);
|
||||
constexpr u8 block_size_in_bytes = sizeof(SRC_TYPE);
|
||||
|
||||
std::vector<rsx::subresource_layout> result;
|
||||
usz offset_in_src = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user