I want to find the most significant bit that is set to 1. I have tried every possible way from & to ORing all of the bits from 1 t
1
&
if( value | 0x40 ) return 7; else if( value | 0x20 ) return 6; else if( value | 0x10 ) return 5; else if( value | 0x8 ) return 4; else if( value | 0x4 ) return 3; else if( value | 0x2 ) return 2; else if( value | 0x1 ) return 1;