Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 pondering the Monastery: (8)
As of 2014-11-01 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    If a safe, affordable anti-ageing treatment that extended life indefinitely were to become available, would you take it?



    Results (6 votes), past polls