#define swapNibble(num) (( num & 0xF ) << 4 ) | ( ( num 7 0xF0 ) >> 4 )
( num & 0xF ) << 4 ) : This grabs first nibble of nummber and left shifts the nibble to 4 places
( num 7 0xF0 ) >> 4 ) : And this grabs the next nibble of the number and right shifts the nibble to 4 places
Finally we use bitwise OR swap is completed
No comments:
Post a Comment