Home > other >  ARM7 assembly shifting a number with a signed integer
ARM7 assembly shifting a number with a signed integer

Time:03-07

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.

CodePudding user response:

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.

  • Related