mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
More constexpr
This commit is contained in:
parent
0bb83ed5e9
commit
29901d65ed
5 changed files with 26 additions and 26 deletions
|
@ -689,7 +689,7 @@ struct fmt::cfmt_src
|
||||||
TYPE(llong);
|
TYPE(llong);
|
||||||
TYPE(schar);
|
TYPE(schar);
|
||||||
TYPE(short);
|
TYPE(short);
|
||||||
if (std::is_signed_v<char>) TYPE(char);
|
if constexpr (std::is_signed_v<char>) TYPE(char);
|
||||||
TYPE(long);
|
TYPE(long);
|
||||||
TYPE(s128);
|
TYPE(s128);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ bool music_selection_context::set(const CellMusicSelectionContext& in)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 pos = sizeof(magic);
|
constexpr u32 pos = sizeof(magic);
|
||||||
hash = &in.data[pos];
|
hash = &in.data[pos];
|
||||||
|
|
||||||
return load_playlist();
|
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>
|
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)
|
FORCE_INLINE static bool _bind_func_args(ppu_thread& CPU, T1 arg1, T... args)
|
||||||
{
|
{
|
||||||
const bool is_float = std::is_floating_point_v<T1>;
|
constexpr bool is_float = std::is_floating_point_v<T1>;
|
||||||
const bool is_vector = std::is_same_v<std::decay_t<T1>, v128>;
|
constexpr 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>;
|
constexpr 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_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_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) :
|
||||||
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
||||||
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
||||||
is_context ? ARG_CONTEXT :
|
is_context ? ARG_CONTEXT :
|
||||||
ARG_UNKNOWN;
|
ARG_UNKNOWN;
|
||||||
|
|
||||||
const u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||||
const u32 f = f_count + is_float;
|
constexpr u32 f = f_count + is_float;
|
||||||
const u32 v = v_count + is_vector;
|
constexpr u32 v = v_count + is_vector;
|
||||||
|
|
||||||
_func_arg<T1, t, g, f, v>::set_value(CPU, arg1);
|
_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_pointer_v<RT>, "Invalid callback result type (pointer)");
|
||||||
static_assert(!std::is_reference_v<RT>, "Invalid callback result type (reference)");
|
static_assert(!std::is_reference_v<RT>, "Invalid callback result type (reference)");
|
||||||
const bool is_float = std::is_floating_point_v<RT>;
|
constexpr bool is_float = std::is_floating_point_v<RT>;
|
||||||
const bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
constexpr 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 _func_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||||
|
|
||||||
return _func_res<RT, t>::get_value(CPU);
|
return _func_res<RT, t>::get_value(CPU);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,13 +192,13 @@ namespace ppu_func_detail
|
||||||
const u32 v_count = (info.last_value >> 24);
|
const u32 v_count = (info.last_value >> 24);
|
||||||
|
|
||||||
// TODO: check calculations
|
// TODO: check calculations
|
||||||
const bool is_float = std::is_floating_point_v<T>;
|
constexpr bool is_float = std::is_floating_point_v<T>;
|
||||||
const bool is_vector = std::is_same_v<std::decay_t<T>, v128>;
|
constexpr 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>;
|
constexpr 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>;
|
constexpr 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_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_general ? (g_count >= 8 ? ARG_STACK : ARG_GENERAL) :
|
||||||
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
is_float ? (f_count >= 13 ? ARG_STACK : ARG_FLOAT) :
|
||||||
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
is_vector ? (v_count >= 12 ? ARG_STACK : ARG_VECTOR) :
|
||||||
|
@ -206,9 +206,9 @@ namespace ppu_func_detail
|
||||||
is_variadic ? ARG_VARIADIC :
|
is_variadic ? ARG_VARIADIC :
|
||||||
ARG_UNKNOWN;
|
ARG_UNKNOWN;
|
||||||
|
|
||||||
const u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
constexpr u32 g = g_count + (is_general || is_float ? 1 : is_vector ? (g_count & 1) + 2 : 0);
|
||||||
const u32 f = f_count + is_float;
|
constexpr u32 f = f_count + is_float;
|
||||||
const u32 v = v_count + is_vector;
|
constexpr u32 v = v_count + is_vector;
|
||||||
|
|
||||||
return call<Types...>(ppu, func, arg_info_pack_t<Info..., t | (g << 8) | (f << 16) | (v << 24)>{});
|
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_pointer_v<RT>, "Invalid function result type (pointer)");
|
||||||
static_assert(!std::is_reference_v<RT>, "Invalid function result type (reference)");
|
static_assert(!std::is_reference_v<RT>, "Invalid function result type (reference)");
|
||||||
static const bool is_float = std::is_floating_point_v<RT>;
|
static constexpr bool is_float = std::is_floating_point_v<RT>;
|
||||||
static const bool is_vector = std::is_same_v<std::decay_t<RT>, v128>;
|
static constexpr 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 arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename RT, typename... T> struct func_binder;
|
template<typename RT, typename... T> struct func_binder;
|
||||||
|
|
|
@ -568,7 +568,7 @@ namespace
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// <= 128 so fits in u8
|
// <= 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;
|
std::vector<rsx::subresource_layout> result;
|
||||||
usz offset_in_src = 0;
|
usz offset_in_src = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue