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

transfer the value of one variable to another using bitwise (<<)

Good morning everyone Forum
I have done a lot of programming and proficient using C but this Kile compiler is new to me and very different. it is confusing me.
I have a question and need your help.
I wonder how can I rotate the left (<<) the value of variable 'A', so to rotate, bitwise be transferred to another variable 'B'.

Parents
  • Note that << and >> perform shifts - not rotates. So if you want to rotate, you need to extract the bit that would be shifted out, and depending on if it was set or clear perform a set or clear of the bit on the other side of the variable after you have performed the shift.

    Besides that, it is standard assign like any other expression where variable b is assigned the value of variable a with some optional operations performed.

Reply
  • Note that << and >> perform shifts - not rotates. So if you want to rotate, you need to extract the bit that would be shifted out, and depending on if it was set or clear perform a set or clear of the bit on the other side of the variable after you have performed the shift.

    Besides that, it is standard assign like any other expression where variable b is assigned the value of variable a with some optional operations performed.

Children
No data