[erlang-questions] bug: R12B-0 internal consistency check

Mateusz Berezecki mateuszb@REDACTED
Sat Dec 22 22:32:58 CET 2007

bitmap: function intersection/4+14:
   Internal consistency check failed - please report this bug.
   Instruction: {bs_put_integer,{f,0},
   Error:       {match_context,{x,5}}:


-module (bitmap).

-export ([gen_bit/2]).
-export ([intersection/4]).

gen_bit(0, Acc) -> Acc;
gen_bit(N, Acc) when is_integer(N), N > 0 -> gen_bit(N-1, <<Acc/ 
binary, (random:uniform(2)-1):1>>).

intersection(<<A:1, Map1/bits>>, <<A:1,Map2/bits>>, K, Acc) ->
	intersection(<<Map1>>, <<Map2>>, K+1, [K|Acc]);

intersection(<<A:1, Map1/bits>>, <<B:1, Map2/bits>>, K, Acc) ->
	intersection(<<Map1>>, <<Map2>>, K+1, [K|Acc]);
intersection(<<>>,_, _, _) -> [];
intersection(_, <<>>, _, _) -> [].


$ erlc bitmap.erl

Mateusz Berezecki

Is there any preferred way to do the intersection of 2 bitmaps using  
new bit syntax ?

What I want to achieve is having two bitmaps I want to have a list of  
integers on which
the two bitmaps have the same bits and I want it to be fast.

More information about the erlang-questions mailing list