This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LSL and LSR instructions

Hi all ,

I need some explanations for the code highlighted below.I got this code from the disassembled window.
Here temp is declared as unsigned short and onech is declared as unsigned Char.
I would like to know why the compiler is doing the LSL and LSR operations here in this part of the code ,though there is only one LSL I have specified in the code .(ie. (temp^onech) << 8.)

Looking for help.
T.Sendhilraj

74: unsigned short ans=((temp^onech) << 8);
MOV R0,R1
MOV R1,R0,LSL #16
MOV R1,R1,LSR #16

MOV R0,R2
MOV R0,R0,LSL #24
MOV R0,R0,LSR #24

EOR R1,R1,R0
MOV R1,R1,LSL #8
MOV R1,R1,LSL #16
MOV R1,R1,LSR #16

0