Bit Switching - How?
Ralph Wirthlin
wirthlin at uvm-gen.UUCP
Tue Apr 4 07:28:42 AEST 1989
This may have already been asked, but ...
Does anyone know of a *very fast* way to swap bits at some location n
between two separate bytes b1 and b2?
offset
3 2 1 0
=======
e.g. b1 -> 0 0 1 1
b2 -> 1 0 1 0
swapping bits at offset 3 would produce
offset
3 2 1 0
=======
b1 -> 1 0 1 1
b2 -> 0 0 1 0
Thanks for any help you can give.
-------------------------------------------------------------------------------
Ralph L. Wirthlin | "Who knows where madness lies ..
EMAIL:wirthlin at uvm-gen.uvm.edu | To surrender dreams, this may be
USMAIL: BOX 125 Newport Ctr., VT | madness .. too much sanity is madness,
| but maddest of all is to see life as
| it is and not as it should be"
| - Man of La Mancha
-------------------------------------------------------------------------------
More information about the Comp.unix.questions
mailing list