forked from Lephenixnoir/fxos
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:
parent
5e20cbe805
commit
a399ed31d7
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue