#include <stdio.h> int func(int v) { v-=1; v|=v>>16; v|=v>>8; v|=v>>4; v|=v>>2; v|=v>>1; return v+1; } void main( ) { printf("%d\n",func(10000)); }