See <a href="http://erlang.org/pipermail/erlang-bugs/2007-December/000569.html">http://erlang.org/pipermail/erlang-bugs/2007-December/000569.html</a><br><br>Add a TypeSpecifier to get past the compilation error:<br><br>intersection(<<A:1, Map1/bits>>, <<A:1,Map2/bits>>, K, Acc) ->
<br>       intersection(<<Map1/bits>>, <<Map2/bits>>, K+1, [K|Acc]);<br><br>intersection(<<A:1, Map1/bits>>, <<B:1, Map2/bits>>, K, Acc) -><br>       intersection(<<Map1/bits>>, <<Map2/bits>>, K+1, [K|Acc]);
<br><br>BR /Fredrik<br><br><br><div class="gmail_quote">On Dec 22, 2007 10:32 PM, Mateusz Berezecki <<a href="mailto:mateuszb@gmail.com">mateuszb@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
BUG:<br>bitmap: function intersection/4+14:<br>   Internal consistency check failed - please report this bug.<br>   Instruction: {bs_put_integer,{f,0},<br>                                {integer,8},<br>                                1,
<br>                                {field_flags,[unsigned,big]},<br>                                {x,5}}<br>   Error:       {match_context,{x,5}}:<br><br><br>WHAT:<br><br>-module (bitmap).<br><br>-export ([gen_bit/2]).
<br>-export ([intersection/4]).<br><br>gen_bit(0, Acc) -> Acc;<br>gen_bit(N, Acc) when is_integer(N), N > 0 -> gen_bit(N-1, <<Acc/<br>binary, (random:uniform(2)-1):1>>).<br><br>intersection(<<A:1, Map1/bits>>, <<A:1,Map2/bits>>, K, Acc) ->
<br>        intersection(<<Map1>>, <<Map2>>, K+1, [K|Acc]);<br><br>intersection(<<A:1, Map1/bits>>, <<B:1, Map2/bits>>, K, Acc) -><br>        intersection(<<Map1>>, <<Map2>>, K+1, [K|Acc]);
<br><br>intersection(<<>>,_, _, _) -> [];<br>intersection(_, <<>>, _, _) -> [].<br><br><br>HOW:<br><br>$ erlc bitmap.erl<br><br><br>Mateusz Berezecki<br><br><br>P.S.<br>Is there any preferred way to do the intersection of 2 bitmaps using
<br>new bit syntax ?<br><br>What I want to achieve is having two bitmaps I want to have a list of<br>integers on which<br>the two bitmaps have the same bits and I want it to be fast.<br><br><br>_______________________________________________
<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions
</a><br></blockquote></div><br>