Re: Shift right arithmetic
Well, this is exactly right.
The binary representative of your 32 bit value is:
Code:
1111 1111 1111 1111 0000 0000 0000 0000 Binary
F F F F 0 0 0 0 Hex
Shifting it right with an Arithmetic shift, the sign bit is duplicated and the result is:
Code:
1111 1111 1111 1111 1110 0000 0000 0000 Binary
F F F F E 0 0 0 Hex
Regards,
Zach
Re: Shift right arithmetic
Thank you so much, I think I was just a little confused about what the shifts actually did.
1 Attachment(s)
Re: Shift right arithmetic
This utility gives you a visual representation of what's going on with the SAR (and several other CPU) instructions. Check it out if you like. The small manual also has examples on several useful logical operations.