ARM7 assembly shifting a number with a signed integer

254 Views Asked by At

I have been trying to shift my number with the formula m*2^-n by using Logical Shift Right (LSR). for m = 8 and n=-2 I should be getting 8(2)^-2 ie; 2, but I get 0 for some unknown reason.

1

There are 1 best solutions below

16
On BEST ANSWER

You need to first negate R1 before you can do ASR. Shift values are unsigned, a negative shift value is interpreted as a very large positive shift, leading to a result of zero.