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

Thanks very much. Good to know.

Replies are listed 'Best First'.
Re^3: vec overflow?
by BrowserUk (Patriarch) on Jun 25, 2013 at 01:34 UTC

    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.