How can I switch the certain bits of a number? For example, given bit representation (just an example, the syntax is surely wrong!):
someNumber = 00110111
changeNumber = 11100110
Then how can I change the far right bit of someNumber
with the far right bit of the changeNumber
without changing the rest bits of the someNumber
? So the result would be:
00110111 //someNumber
11100110 //changeNumber
________
00110110