Skip to content

Commit

Permalink
arm64: print shifter in decimal mode. this is to be consistent with A…
Browse files Browse the repository at this point in the history
…RM engine
  • Loading branch information
aquynh committed Nov 8, 2014
1 parent 9025e92 commit c109e8e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions SStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ void printInt64(SStream *O, int64_t val)
}
}

// print number in decimal mode
void printInt32BangDec(SStream *O, int32_t val)
{
if (val >= 0)
SStream_concat(O, "#%u", val);
else
SStream_concat(O, "#-%u", -val);
}

void printInt32Bang(SStream *O, int32_t val)
{
if (val >= 0) {
Expand Down
3 changes: 3 additions & 0 deletions SStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ void printUInt32Bang(SStream *O, uint32_t val);

void printUInt32(SStream *O, uint32_t val);

// print number in decimal mode
void printInt32BangDec(SStream *O, int32_t val);

#endif
2 changes: 1 addition & 1 deletion arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ static void printShifter(MCInst *MI, unsigned OpNum, SStream *O)
return;

SStream_concat(O, ", %s ", AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val)));
printInt32Bang(O, AArch64_AM_getShiftValue(Val));
printInt32BangDec(O, AArch64_AM_getShiftValue(Val));
if (MI->csh->detail) {
arm64_shifter shifter = ARM64_SFT_INVALID;
switch(AArch64_AM_getShiftType(Val)) {
Expand Down

0 comments on commit c109e8e

Please sign in to comment.