in reply to Decimal to Hexadecimal conversion and extraction MSB

... if I have a hexadecimal number such as "1110 1111", I need to extract the left most "1" bit and left shift the original hexadecimal number resulting in "1101 1110" as the new value. ...

here is one more:

perl -e"$n = shift; for (1..9){ print substr (unpack('B32', pack('N', $n)), 24,8); $n=($n*2)%512; print ' - shifting: ' ,$n>255? 1:0,qq/\n/; }" 239 11101111 - shifting: 1 11011110 - shifting: 1 10111100 - shifting: 1 01111000 - shifting: 0 11110000 - shifting: 1 11100000 - shifting: 1 11000000 - shifting: 1 10000000 - shifting: 1 00000000 - shifting: 0

Cheers, Christoph