Search

Sponsored Links

Meta

Categories

Archives

Recent Posts

RSS Feeds

01
Nov

Swap Bits in a Byte without using any extra variable

Related Blog Items

SwapBitsInByte(unsigned char n)
{
  n = (n & 0xF0) >> 4 | (n & 0x0F) < < 4;
  n = (n & 0xCC) >> 2 | (n & 0×33) < < 2;
  n = (n & 0xAA) >> 1 | (n & 0×55) << 1;
  return n;
}

download this code

Popularity: 12%

You need to log on to convert this article into PDF


Related Blog Items

No Comments

No comments yet.

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image