Thread: swapping nibbles

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

    Post swapping nibbles

    What logic shud be used for swapping nibbles in a byte??

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by rits View Post
    What logic shud be used for swapping nibbles in a byte??
    Bitwise AND, bit-shift, bitwise or...

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    198
    This may be a way to do it:

    1. Store top nibble in temporary variable
    2. Shift the lower nibble to the top
    3. Put the temporary variable in as the lower nibble.

    Post the result here when you are done.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Monitoring Page Swapping?
    By Cell in forum Linux Programming
    Replies: 10
    Last Post: 06-13-2010, 12:16 PM
  2. C bubble sort?
    By fredanthony in forum C Programming
    Replies: 11
    Last Post: 02-13-2006, 09:54 PM
  3. Nibbles (src included)
    By Perspective in forum Game Programming
    Replies: 7
    Last Post: 08-02-2004, 12:35 PM
  4. The Fifth Contest - Nibbles -- Sign Up
    By ygfperson in forum Contests Board
    Replies: 42
    Last Post: 08-30-2002, 07:58 PM
  5. swapping within a char pointer array
    By Mario in forum C++ Programming
    Replies: 3
    Last Post: 05-25-2002, 01:31 AM