diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 90a8418cf6..88ff7e2991 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -689,7 +689,7 @@ struct fmt::cfmt_src TYPE(llong); TYPE(schar); TYPE(short); - if (std::is_signed_v) TYPE(char); + if constexpr (std::is_signed_v) TYPE(char); TYPE(long); TYPE(s128); diff --git a/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp b/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp index 270786ed72..9582df894c 100644 --- a/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMusicSelectionContext.cpp @@ -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(); diff --git a/rpcs3/Emu/Cell/PPUCallback.h b/rpcs3/Emu/Cell/PPUCallback.h index 2a8ff78608..8f25cb6c0b 100644 --- a/rpcs3/Emu/Cell/PPUCallback.h +++ b/rpcs3/Emu/Cell/PPUCallback.h @@ -92,21 +92,21 @@ namespace ppu_cb_detail template FORCE_INLINE static bool _bind_func_args(ppu_thread& CPU, T1 arg1, T... args) { - const bool is_float = std::is_floating_point_v; - const bool is_vector = std::is_same_v, v128>; - const bool is_context = std::is_same_v, ppu_thread>; - const bool is_general = !is_float && !is_vector && !is_context; + constexpr bool is_float = std::is_floating_point_v; + constexpr bool is_vector = std::is_same_v, v128>; + constexpr bool is_context = std::is_same_v, 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::set_value(CPU, arg1); @@ -157,9 +157,9 @@ namespace ppu_cb_detail static_assert(!std::is_pointer_v, "Invalid callback result type (pointer)"); static_assert(!std::is_reference_v, "Invalid callback result type (reference)"); - const bool is_float = std::is_floating_point_v; - const bool is_vector = std::is_same_v, 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; + constexpr bool is_vector = std::is_same_v, v128>; + constexpr _func_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); return _func_res::get_value(CPU); } diff --git a/rpcs3/Emu/Cell/PPUFunction.h b/rpcs3/Emu/Cell/PPUFunction.h index f8e02f20d9..a42ae12d65 100644 --- a/rpcs3/Emu/Cell/PPUFunction.h +++ b/rpcs3/Emu/Cell/PPUFunction.h @@ -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; - const bool is_vector = std::is_same_v, v128>; - const bool is_context = std::is_base_of_v, ppu_thread>; - const bool is_variadic = std::is_same_v, 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; + constexpr bool is_vector = std::is_same_v, v128>; + constexpr bool is_context = std::is_base_of_v, ppu_thread>; + constexpr bool is_variadic = std::is_same_v, 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(ppu, func, arg_info_pack_t{}); } @@ -218,9 +218,9 @@ namespace ppu_func_detail { static_assert(!std::is_pointer_v, "Invalid function result type (pointer)"); static_assert(!std::is_reference_v, "Invalid function result type (reference)"); - static const bool is_float = std::is_floating_point_v; - static const bool is_vector = std::is_same_v, 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; + static constexpr bool is_vector = std::is_same_v, v128>; + static constexpr arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); }; template struct func_binder; diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index e5aadb09bf..05146eb4a3 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -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 result; usz offset_in_src = 0;