in reply to
Re: vec overflow?
in thread vec overflow?
Thanks very much. Good to know.
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.
A Programming Language, 1962
Programming the 1900 series in COBOL, 1974
Algorithms + Data Structures = Programs, 1976
The C Programming Language, 1978
System V - Interface definition, 1986
Z80 Assembly Language Programming, 1979
TheSOURCE User's Manual, 1979
The C Primer, 1983
Interactive Fortran 77, A Hands on Approach, 1984
Perl.1 man page, 1991
Results (337 votes),