in reply to Decimal to Hexadecimal conversion and extraction MSB

To find the most significant bit, you keep shifting right (with the ">>" operator), which is the same as an integer divide by two, until the value is zero. The last shifted bit is the most significant.

But your question confuses me some - are you mixing "bit" with "hex digit"? If you left shift a hex "110 1111", you get "220 2222", not "1101 1110" (you need 4 left binary shifts, or 1 left hex digit shift). Are you extracting the most significant bit or the most significant hex digit? An example using digits other than 0 and 1 would help a lot if it's not a binary number.

  • Comment on Re: Decimal to Hexadecimal conversion and extraction MSB