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

Fredrik Svahn <>
Sat Dec 22 23:02:31 CET 2007


See http://erlang.org/pipermail/erlang-bugs/2007-December/000569.html

Add a TypeSpecifier to get past the compilation error:

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

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

BR /Fredrik


On Dec 22, 2007 10:32 PM, Mateusz Berezecki <> wrote:

> BUG:
> bitmap: function intersection/4+14:
>   Internal consistency check failed - please report this bug.
>   Instruction: {bs_put_integer,{f,0},
>                                {integer,8},
>                                1,
>                                {field_flags,[unsigned,big]},
>                                {x,5}}
>   Error:       {match_context,{x,5}}:
>
>
> WHAT:
>
> -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(_, <<>>, _, _) -> [].
>
>
> HOW:
>
> $ erlc bitmap.erl
>
>
> Mateusz Berezecki
>
>
> P.S.
> 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.
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071222/daf50aa3/attachment.html>


More information about the erlang-questions mailing list