diff --git a/src/bloom.erl b/src/bloom.erl index b0473fc..9aec56b 100644 --- a/src/bloom.erl +++ b/src/bloom.erl @@ -67,7 +67,7 @@ add_element(Key, #bloom{keys=Keys, n=N, bitmap=Bitmap} = B) when Keys < N -> Idxs = calc_idxs(Key, B), Bitmap0 = set_bits(Bitmap, Idxs), case Bitmap0 == Bitmap of - true -> B; % Don't increment key count for duplicates. + true -> B#bloom{bitmap=Bitmap0}; % Don't increment key count for duplicates. false -> B#bloom{bitmap=Bitmap0, keys=Keys+1} end. @@ -82,6 +82,11 @@ set_bits(Bin, [Idx | Idxs]) -> Byte0 = Byte bor Mask, set_bits(<
>, Idxs).
 
+%set_bits(Bin, [Idx | Idxs]) ->
+%    <> = Bin,
+%    set_bits(<
>, Idxs).
+
+
 %% @internal
 %% @doc Find the optimal bitmap size and number of hashes.
 %TODO -spec(non_neg_integer(), number()) -> non_neg_integer().