Monday, 23 May 2011

Bit manipulation

a |= 0x4; /* Set bit 2 */

b &= ˜0x4; /* Clear bit 2 */

c &= ˜(1 << 3); /* Clear bit 3 */

d ˆ= (1 << 5); /* Toggle bit 5 */

e >>= 2; /* Divide e by 4 */

f <<= 2; /* Multiplay f by power 2 of 2 = 4 */

No comments:

Post a Comment