Skip to content

Commit

Permalink
Merge pull request #111 from sp1187/master
Browse files Browse the repository at this point in the history
Fix shift undefined behaviour in CArmInstruction
  • Loading branch information
Kingcom committed Jul 10, 2017
2 parents 7f8579a + 05dddf8 commit 6f4daef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Archs/ARM/CArmInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ int CArmInstruction::getShiftedImmediate(unsigned int num, int& ShiftAmount)
{
for (int i = 0; i < 32; i+=2)
{
unsigned int andval = (0xFFFFFF00 >> i) | (0xFFFFFF00 << (32-i));
unsigned int andval = (0xFFFFFF00 >> i) | (0xFFFFFF00 << (-i & 31));

if ((num & andval) == 0) // found it
{
ShiftAmount = i;
return (num << i) | (num >> (32 - i));
return (num << i) | (num >> (-i & 31));
}
}
return -1;
Expand Down

0 comments on commit 6f4daef

Please sign in to comment.