Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!uvm-gen!wirthlin From: wirthlin@uvm-gen.UUCP (Ralph Wirthlin) Newsgroups: comp.unix.questions Subject: Bit Switching - How? Keywords: bits, flip Message-ID: <1138@uvm-gen.UUCP> Date: 3 Apr 89 21:28:42 GMT Distribution: usa Organization: EMBA Computer Facility, Univ. of Vermont, Burlington. Lines: 31 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@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 -------------------------------------------------------------------------------