If I have -2 (11111111111111111111111111111110), is there a neat ARM instruction or a series of such that will make it (00000000000000000000000000000010). OR or XOR would not work from what I have tried since I loose the 30th bit.
Thank you
If I have -2 (11111111111111111111111111111110), is there a neat ARM instruction or a series of such that will make it (00000000000000000000000000000010). OR or XOR would not work from what I have tried since I loose the 30th bit.
Thank you
For finding the absolute value of an integer, use a comparison and a subtraction.
@ input in r0
cmp r0, #0 @ is r0 < 0?
rsbmi r0, r0 #0 @ if yes, r0 = 0 - r0