Skip to content

Commit 3b56adb

Browse files
committed
fix: The length of the bucket must be greater than the capacity
1 parent 9cab49f commit 3b56adb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/BloomFilter/FilterMemory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public FilterMemory(FilterMemoryOptions options)
3434
}
3535
else if (options.BucketBytes is not null)
3636
{
37-
Import(options.Bytes, options.BytesMore);
37+
Import(options.BucketBytes);
3838
}
3939
else if (options.Bits is not null)
4040
{
@@ -124,9 +124,9 @@ public void Import(BitArray[] buckets)
124124
if (buckets.Length == 0)
125125
throw new ArgumentOutOfRangeException($"The length must greater than 0", nameof(buckets));
126126

127-
if (Capacity != buckets.Sum(s => (long)s.Length))
127+
if (Capacity > buckets.Sum(s => (long)s.Length))
128128
{
129-
throw new ArgumentOutOfRangeException($"The length must {Capacity}", nameof(buckets));
129+
throw new ArgumentOutOfRangeException($"The length must less than or equal to {Capacity}", nameof(buckets));
130130
}
131131

132132
lock (sync)

0 commit comments

Comments
 (0)