have you tried http://www.cprogramming.com/tutorial/bitwise_operators.html