relconst: fix a printing bug causing some constants to show as 0

Constants (no base) that fit on a single byte would print as 0 due to
flawed logic.
This commit is contained in:
Lephenixnoir 2022-12-22 09:54:31 +01:00
parent 5e20cbe805
commit a399ed31d7
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 10 additions and 5 deletions

View File

@ -300,12 +300,17 @@ std::string RelConst::str() const noexcept
if(ival >= -256 && ival < 256) {
uint32_t v = 0;
if(str.size() && ival > 0)
str += "+", v = ival;
if(str.size() && ival < 0)
str += "-", v = -ival;
if(ival >= 0) {
if(str.size())
str += "+";
v = ival;
}
else {
str += "-";
v = -ival;
}
return str + format("%d", v);
return str + format("%d (0x%08x)", v, uval);
}
else {
return str + format("0x%08x", uval);