I\'m converting an unsigned integer to binary using bitwise operators, and currently do integer & 1 to check if bit is 1 or 0 and output, then right shift by 1 to divide
unsigned int rev_bits(unsigned int input)
{
unsigned int output = 0;
unsigned int n = sizeof(input) << 3;
unsigned int i = 0;
for (i = 0; i < n; i++)
if ((input >> i) & 0x1)
output |= (0x1 << (n - 1 - i));
return output;
}