[erlang-questions] A bug? - bloom filters - and loadable BIFs
Thu Apr 30 18:25:28 CEST 2009
is there a way to do a destructive setelement?
This is in the VM, but the compiler rarely generates it.
Is there a way to force this?
From: Steve Kirsch
Wow. That is very cool. And if the bitarray is large enough, it is
passed by reference in a message. Awesome.
So is there a way to set a byte or word at a time??
hipe_bifs:bitarray(NrArrayBits, InitialBitValue) -> BitArray
hipe_bifs:bitarray_sub(BitArray, BitNr) -> BitValue
hipe_bifs:bitarray_update(BitArray, BitNr, BitValue) -> BitArray
Bit values are the booleans true and false.
Array indexing is 0-based (1-based indexing is just sooo wrong).
The update operation returns the updated array.
The number of elements in a bit array is limited to what can be
described by non-negative fixnums (immediate "small" integers), which is
something like 2^27 - 1 on 32-bit machines. Larger bitarrays than that
must be emulated using a chunked representation.
See lib/hipe/regalloc/hipe_ig.erl for an example (look for the
USE_NEW_BITARRAY_BIFS define and the adjset code following it).
More information about the erlang-questions