Thread: Interchanging the bits

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    46

    Question Interchanging the bits

    how can i interchange every 2 bits in a byte like if 10 01 10 01 is input then output shud be 01 10 01 10. Please help me.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    It could be done with bit shifts and masks. A lookup table might also be useful.

    Post the code you have thus far.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDLKey to ASCII without unicode support?
    By zacs7 in forum Game Programming
    Replies: 6
    Last Post: 10-07-2007, 03:03 AM
  2. Replies: 7
    Last Post: 08-19-2007, 08:10 AM
  3. Help counting number of bits set in an integer
    By JayDiddums10 in forum C Programming
    Replies: 5
    Last Post: 12-07-2006, 03:21 PM
  4. Writing binary data to a file (bits).
    By OOPboredom in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 03:53 PM
  5. New idea on conveting byte to bits/bits to byte
    By megablue in forum C Programming
    Replies: 10
    Last Post: 10-26-2003, 01:16 AM