1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
unsigned foo( unsigned x ) { unsigned t; for ( int i = 0; i < 30; ++i ) { t = ( x & 1 ) << 31; x >>= 1; x |= t; } return x; } int main() { cout << foo( 23 ); }
1
92