Skip to content

Commit

Permalink
Debugger: Fix SignedHex
Browse files Browse the repository at this point in the history
It didnt take into account INTx_MIN. (UB for std::abs)
  • Loading branch information
elad335 authored and Nekotekina committed Oct 23, 2020
1 parent 0bb3609 commit 552d8e6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rpcs3/Emu/CPU/CPUDisAsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ class CPUDisAsm
static std::string SignedHex(T value)
{
const auto v = static_cast<std::make_signed_t<T>>(value);

if (v == std::numeric_limits<std::make_signed_t<T>>::min())
{
// for INTx_MIN
return fmt::format("-0x%x", v);
}

const auto av = std::abs(v);

if (av < 10)
Expand Down

0 comments on commit 552d8e6

Please sign in to comment.