Macro to swap nibble of BYTE source code
This snippet submitted by T Sailesh on 2006-06-08. It has been viewed 2636 times.
Rating of 6.0 with 7 votes
#define _swapNibble(x) ((x<<4)|(x>>4))
int main()
{
// On executing you will get
// x before swap = 0x1c
// x after swap = 0xc1
char x = 0x1c;
printf("x before swap = %x\n",x);
_swapNibble(x);
printf("x afer swap = %x",x);
}
More C and C++ source code snippets
Add a snippet!