[erlang-questions] bug: internal error in v3_codegen
Mateusz Berezecki
mateuszb@REDACTED
Sat Jan 19 22:35:45 CET 2008
Hello list,
I am both sorry and amused of reporting this error, as I sort of have
really
unlucky day when it comes to erlang. I don't know if it was reported
before or not,
but here it is
Function: set_bit/2
./bitmap.erl:none: internal error in v3_codegen;
crash reason: {{case_clause,
{'EXIT',
{function_clause,
[{v3_codegen,fetch_reg,[ker1,[]]},
{v3_codegen,move_unsaved,4},
{v3_codegen,cg_call_args,4},
{v3_codegen,cg_setup_call,4},
{v3_codegen,break_cg,5},
{v3_codegen,'-cg_list/5-anonymous-0-',3},
{v3_codegen,flatmapfoldl,3},
{v3_codegen,cg_list,5}]}}},
[{compile,'-select_passes/2-anonymous-2-',2},
{compile,'-internal_comp/4-anonymous-1-',2},
{compile,fold_comp,3},
{compile,internal_comp,4},
{compile,internal,3}]}
the code is after the e-mail
best regards,
Mateusz Berezecki
-module (bitmap).
-author ('Mateusz Berezecki').
-export ([gen_bit/2, set_bit/2, clr_bit/2]).
-export ([intersection/4]).
-define (BITMAP_SIZE, 120*8).
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(<<>>, <<>>, _, Acc) -> Acc;
intersection(<<A:1, Rest1/bits>>, <<A:1, Rest2/bits>>, K, Acc) ->
intersection(Rest1, Rest2, K+1, [K | Acc]);
intersection(<<A:1, Rest1/bits>>, <<B:1, Rest2/bits>>, K, Acc) ->
intersection(Rest1, Rest2, K+1, Acc).
% sets bit K in the Bitmap
set_bit(<<Start:32/unsigned-little-integer,Bitmap/bits>>, K) when
is_integer(K) andalso
bit_size(Bitmap) >= K andalso
0 < K ->
Before = K-1,
After = bit_size(Bitmap) - K,
<<BeforeBits:Before/bits, _:1, AfterBits:After/bits>> = Bitmap,
<<BeforeBits/bits, 1:1, AfterBits/bits>>.
% clears bit K in the Bitmap
clr_bit(<<Start:32/unsigned-little-integer, Bitmap/bits>>, K) when
is_integer(K) andalso
bit_size(Bitmap) >= K andalso
0 < K ->
Before = K-1,
After = bit_size(Bitmap) - K,
<<BeforeBits:Before/bits, _:1, AfterBits:After/bits>> = Bitmap,
<<BeforeBits/bits, 0:1, AfterBits/bits>>.
%from_list(L) when is_list(L), length(L) <= ?BITMAP_SIZE ->
More information about the erlang-questions
mailing list