diff --git a/Utilities/cfmt.h b/Utilities/cfmt.h index 8caa9da117..4ff65d1156 100644 --- a/Utilities/cfmt.h +++ b/Utilities/cfmt.h @@ -412,10 +412,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) } const u64 mask = - ctx.type == 1 ? u64{std::numeric_limits>::max()} : - ctx.type == 2 ? u64{std::numeric_limits>::max()} : - ctx.type == 4 ? u64{std::numeric_limits>::max()} : - u64{std::numeric_limits>::max()}; + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; // Trunc sign-extended signed types const u64 val = src.template get(ctx.args) & mask; @@ -469,10 +469,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) } const u64 mask = - ctx.type == 1 ? u64{std::numeric_limits>::max()} : - ctx.type == 2 ? u64{std::numeric_limits>::max()} : - ctx.type == 4 ? u64{std::numeric_limits>::max()} : - u64{std::numeric_limits>::max()}; + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; // Trunc sign-extended signed types const u64 val = src.template get(ctx.args) & mask; @@ -533,10 +533,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) } const u64 mask = - ctx.type == 1 ? u64{std::numeric_limits>::max()} : - ctx.type == 2 ? u64{std::numeric_limits>::max()} : - ctx.type == 4 ? u64{std::numeric_limits>::max()} : - u64{std::numeric_limits>::max()}; + ctx.type == 1 ? 0xff : + ctx.type == 2 ? 0xffff : + ctx.type == 4 ? 0xffff'ffffu : + 0xffff'ffff'ffff'ffffu; // Trunc sign-extended signed types const u64 val = src.template get(ctx.args) & mask; diff --git a/Utilities/types.h b/Utilities/types.h index a1e211fb02..11cd8f7511 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -131,38 +131,45 @@ using steady_clock = std::conditional< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock>::type; -// Get unsigned integral type from type size -template +// Get integral type from type size +template struct get_int_impl { }; -template<> +template <> struct get_int_impl { - using type = u8; + using utype = u8; + using stype = s8; }; -template<> +template <> struct get_int_impl { - using type = u16; + using utype = u16; + using stype = s16; }; -template<> +template <> struct get_int_impl { - using type = u32; + using utype = u32; + using stype = s32; }; -template<> +template <> struct get_int_impl { - using type = u64; + using utype = u64; + using stype = s64; }; -template -using get_int_t = typename get_int_impl::type; +template +using get_uint_t = typename get_int_impl::utype; + +template +using get_sint_t = typename get_int_impl::stype; namespace gsl { diff --git a/rpcs3/Emu/RSX/rsx_decode.h b/rpcs3/Emu/RSX/rsx_decode.h index 9f13cd98fd..256052a141 100644 --- a/rpcs3/Emu/RSX/rsx_decode.h +++ b/rpcs3/Emu/RSX/rsx_decode.h @@ -68,7 +68,7 @@ struct registers_decoder {}; // Use the smallest type by default -template(static_cast((UINTMAX_C(1) << ::ceil2(N)) / CHAR_BIT), 1)>> +template (static_cast((UINTMAX_C(1) << ::ceil2(N)) / CHAR_BIT), 1)>> static constexpr inline T bf_decoder(const u32& bits) { return static_cast(bf_t::extract(bits)); @@ -2320,7 +2320,7 @@ struct registers_decoder { private: u32 value; - + public: decoded_type(u32 value) : value(value) {} @@ -2508,7 +2508,7 @@ struct registers_decoder public: decoded_type(u32 value) : value(value) {} - u8 stencil_func_mask() const + u8 stencil_func_mask() const { return bf_decoder<0, 8>(value); } @@ -2531,7 +2531,7 @@ struct registers_decoder public: decoded_type(u32 value) : value(value) {} - u8 back_stencil_func_mask() const + u8 back_stencil_func_mask() const { return bf_decoder<0, 8>(value); } @@ -2556,7 +2556,7 @@ struct registers_decoder u8 alpha_ref() const { - return bf_decoder<0, 8>(value); + return bf_decoder<0, 8>(value); } }; @@ -2914,7 +2914,7 @@ struct registers_decoder { private: u32 value; - + u16 src_blend_rgb_raw() const { return bf_decoder<0, 16>(value); @@ -2952,7 +2952,7 @@ struct registers_decoder { private: u32 value; - + u16 dst_blend_rgb_raw() const { return bf_decoder<0, 16>(value); @@ -3814,7 +3814,7 @@ struct registers_decoder { return bf_decoder<16, 16, u32>(value); } - + public: decoded_type(u32 value) : value(value) {}