#include <stdio.h> #include <math.h> unsigned int rev1(unsigned int x) { return x ^ (1 << (int)(log(x + 0.9) / log(2.0) + 0.1) + 1) - 1; } int main() { printf("%u\n",rev1(3456)); return 0; }