Skip to content

Commit

Permalink
libvixl: Avoid std::abs() of 64-bit type
Browse files Browse the repository at this point in the history
The std::abs() function did not get a version that works on
'long long' until C++11. Avoid it, so that we can compile on
32-bit platforms (where int64_t is 'long long') with older
compilers (which don't support C++11).

Reported-by: Franz-Josef Haider <Franz-Josef.Haider@student.uibk.ac.at>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453739429-31477-1-git-send-email-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Feb 3, 2016
1 parent 6d152eb commit 0602f42
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion disas/libvixl/vixl/a64/disasm-a64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2688,8 +2688,12 @@ void Disassembler::AppendRegisterNameToOutput(const Instruction* instr,
void Disassembler::AppendPCRelativeOffsetToOutput(const Instruction* instr,
int64_t offset) {
USE(instr);
uint64_t abs_offset = offset;
char sign = (offset < 0) ? '-' : '+';
AppendToOutput("#%c0x%" PRIx64, sign, std::abs(offset));
if (offset < 0) {
abs_offset = -abs_offset;
}
AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
}


Expand Down

0 comments on commit 0602f42

Please sign in to comment.