Logical shift always shifts "0" in from left to right. Arithmetic shift shifts the sign bit of the register from left to right. That means when the register is initially a negative value, every shift whifts in "1"s and if it is a positive value then "0"s will be shifted in. Example: A byte initially contains 11001010 (0xca) After one ASR this byte will look like 11100101 (0xe5) as 0xca is a negative value (sign bit - b7 is set) But after one LSR this byte becomes 01100101 (0x65). So the LSR shifts zeros in regardless of the sign bit. Hope this clarifies everything... Kerem --- In lpc2000@yahoogroups.com, ©@°Ø¦â¤p¿ß <sevenstar_uk@h...> wrote: > > whats the difference in between ASR(arithematic shift right) and LSR > (logical shift right) as they are basically doing the same thing? > can someone tell me when to use ASR and when to use LSR? thank u!
Message
Re: question on ARM instruction
2004-12-14 by Kerem Or
Attachments
- No local attachments were found for this message.