>601
はいよ。xが2の何乗かを調べる関数。2のべき乗以外の数入れると-1かえす。

int log_2( int x ) {
int ans = 0;
if ( (x & x-1) != 0 ) return -1;
--x;
while ( x ) x >>= 1, ++ans;
return ans;
}