|
-
February 28th, 2003, 05:58 PM
#1
Easy way to swap two bits in a Byte?
I'm currently trying to figure out an easy way to swap to bits in a Byte variable.
So for example I want to swap the x and y in 0101 0x1y, so that it becomes 0101 0y1x. The other bits shouldn't be changed.
Currently I'm using if statements, but I just imagine that there is an easier (faster) way to do it with bit operations. (xor, &, |).
Or am I totally wrong and there is only the way with the if statments?
Pherhaps somebody does know it an is so friendly to help me.
Sincerely,
Michael Menne
Last edited by Michael Menne; February 28th, 2003 at 06:03 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|