Formatting
This commit is contained in:
parent
17cb87ca42
commit
a50e8bdb0d
1 changed files with 3 additions and 7 deletions
|
@ -63,7 +63,8 @@ is_element(Key, B, [Idx | T]) ->
|
||||||
|
|
||||||
%% @doc Adds the key to the filter.
|
%% @doc Adds the key to the filter.
|
||||||
-spec add_element(term(), #bloom{}) -> #bloom{}.
|
-spec add_element(term(), #bloom{}) -> #bloom{}.
|
||||||
add_element(Key, #bloom{keys=Keys, n=N, bitmap=Bitmap} = B) when Keys < N ->
|
add_element(Key, #bloom{keys=Keys, n=N, bitmap=Bitmap}=B)
|
||||||
|
when Keys < N ->
|
||||||
Idxs = calc_idxs(Key, B),
|
Idxs = calc_idxs(Key, B),
|
||||||
Bitmap0 = set_bits(Bitmap, Idxs),
|
Bitmap0 = set_bits(Bitmap, Idxs),
|
||||||
case Bitmap0 == Bitmap of
|
case Bitmap0 == Bitmap of
|
||||||
|
@ -82,11 +83,6 @@ set_bits(Bin, [Idx | Idxs]) ->
|
||||||
Byte0 = Byte bor Mask,
|
Byte0 = Byte bor Mask,
|
||||||
set_bits(<<Pre/binary, Byte0:8, Post/binary>>, Idxs).
|
set_bits(<<Pre/binary, Byte0:8, Post/binary>>, Idxs).
|
||||||
|
|
||||||
%set_bits(Bin, [Idx | Idxs]) ->
|
|
||||||
% <<Pre:Idx/bitstring, _:1/bitstring, Post/bitstring>> = Bin,
|
|
||||||
% set_bits(<<Pre/bitstring, 1:1, Post/bitstring>>, Idxs).
|
|
||||||
|
|
||||||
|
|
||||||
%% @internal
|
%% @internal
|
||||||
%% @doc Find the optimal bitmap size and number of hashes.
|
%% @doc Find the optimal bitmap size and number of hashes.
|
||||||
%TODO -spec(non_neg_integer(), number()) -> non_neg_integer().
|
%TODO -spec(non_neg_integer(), number()) -> non_neg_integer().
|
||||||
|
|
Loading…
Reference in a new issue