summaryrefslogtreecommitdiffstats
path: root/disas
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-03 13:46:34 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:31:25 -0600
commit5a66e8b69d702a80b6e12178fbc4783274ac15c1 (patch)
tree3c7f754b5a5d208d312926262a3f42479a1e9eb7 /disas
parentfe598a5e797c594f29eed232dbd5b3af7a71d6ef (diff)
downloadhqemu-5a66e8b69d702a80b6e12178fbc4783274ac15c1.zip
hqemu-5a66e8b69d702a80b6e12178fbc4783274ac15c1.tar.gz
libvixl: Avoid std::abs() of 64-bit type
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
Diffstat (limited to 'disas')
-rw-r--r--disas/libvixl/vixl/a64/disasm-a64.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/disas/libvixl/vixl/a64/disasm-a64.cc b/disas/libvixl/vixl/a64/disasm-a64.cc
index 20caba4..7a58a5c 100644
--- a/disas/libvixl/vixl/a64/disasm-a64.cc
+++ b/disas/libvixl/vixl/a64/disasm-a64.cc
@@ -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);
}
OpenPOWER on IntegriCloud