Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Efficient bit-twiddling in Perl.

by kcott (Abbot)
on Mar 01, 2013 at 08:56 UTC ( #1021191=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    sub just_shift {
        return ($n >> 18, $n << 46 >> 58, $n << 52 >> 58, $n << 58 >> 58);
    }
    
  2. or download this
    $ pm_bit_twiddle.pl
    and_rshift:    2147883105 => 8193 : 33 : 33 : 33
    ...
    mixed_assign  2182671/s        12%            5%           --       -4
    +6%    -48%
    just_shift    4037158/s       108%           93%          85%         
    +--     -3%
    mixed         4163497/s       114%           99%          91%         
    +3%      --
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021191]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-29 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls