in reply to calculating the 3 MSBs from an integer

In general, it may be useful to know what "MSB" means, because it depends on the machine. The following should be a simple and portable method of converting any unsigned integer to its binary representation:

sub dec2bin { return sprintf("%b", $_[0]); }

Replies are listed 'Best First'.
Re^2: calculating the 3 MSBs from an integer
by insaniac (Friar) on Feb 18, 2005 at 11:57 UTC
    yeah true... but it seems the bitshifting works correctly on whatever OS, so it's just the visual representation that can be a bit akward... but that was not a requirement ;-)

    thanks for the info..

    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame