Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: 5x6-bit values into/out of a 32-bit word

by grinder (Bishop)
on Mar 18, 2007 at 09:22 UTC ( #605340=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $num = shift;
    my $bits = 6;
    ...
        ($num & $mask << $_ * $bits)
        >> $_ * $bits
    } 0..$bits-1;
    
  2. or download this
    my $num    = shift;
    my $groups = 5;
    ...
        ($num & $mask << $_ * $bits)
        >> $_ * $bits
    } 0..$groups-1;
    
  3. or download this
    my @in  = (30, 14, 27, 2, 17);
    my $width  = 6;
    ...
    my $offset = 0;
    my $out = 0;
    $out |= ($_ << ($offset++ * $width)) for @in;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://605340]
help
Chatterbox?
[Corion]: Discipulus: I've looked for something but never found anything good
Corion looks at the SVG. If the different regions have IDs, then you can colorize the map by providing a CSS file with the colors.
[Corion]: Meh. IE crashes when displaying that SVG as saved from Firefox ...
LanX blame Canada!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2017-03-23 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.