Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: vec overflow?

by BrowserUk (Pope)
on Jun 25, 2013 at 01:34 UTC ( #1040511=note: print w/replies, xml ) Need Help??


in reply to Re^2: vec overflow?
in thread vec overflow?

Another workaround that is useful if your algorithm benefits from having a single contiguous bitvector -- for example if you want to count the set bits quickly using my $popcount = unpack '%32b*', $bitvector; -- is to nest calls to vec. Eg:

vec( vec( $bitvector, $n >> 5, 64 ), $n & 0x1f, 1 ) = 1;

Theoretically, as neither offset breaches the 2**31-1 barrier, this can allow you to address bitvectors up to 16GB/137 billion bits, though I don't have enough memory to try it.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040511]
help
Chatterbox?
[james28909]: for 0 .. 3 {print $hash{$ref}}$_;
[james28909]: or i guess that is a hash ref
[james28909]: hash of array ref <.<
[james28909]: im also about to embark on porting the discord api to perl, without having to have 400 dependencies...
[james28909]: would be nice to link doscord to irc and other services

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2017-05-01 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (544 votes). Check out past polls.