Shift Arithmetic Right in Assembly
velocityxlrg
Posts: 18
I've been using the following in spin:
x:=100000
temp:=x + cnt
repeat
if (temp-cnt) ~> 31 'shift arithmetic right
do stuff, time's up...
else
do something else, keep waiting...
I got this from a post from Mike Green and it works, but try as I might I don't understand how.
The problem is now I would like to translate it into assembly, but my lack of understanding is
preventing me from making any progress.
x:=100000
temp:=x + cnt
repeat
if (temp-cnt) ~> 31 'shift arithmetic right
do stuff, time's up...
else
do something else, keep waiting...
I got this from a post from Mike Green and it works, but try as I might I don't understand how.
The problem is now I would like to translate it into assembly, but my lack of understanding is
preventing me from making any progress.
Comments
You could do the same thing with "temp - cnt < 0" instead of "(temp-cnt) ~> 31".
It shifts the sign bit all the way to the right replacing all the bits of the number.