Solution assuming MSB the last digit x=((x>>1)&0x55555555) | ((x<<1)&0xAAAAAAAA); x=((x>>2)&0x33333333) | ((x<<2)&0xCCCCCCCC); x=((x>>4)&0x0F0F0F0F) | ((x<<4)&0xF0F0F0F0); x=((x>>8)&0x00FF00FF) | ((x<<8)&0xFF00FF00); x=((x>>16)&0x0000FFFF) | ((x<<16)&0xFFFF0000);
while(!(x&1))x>>=1; -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.