parent
3071aea62d
commit
b66b6cacbb
|
@ -87,7 +87,7 @@ public class BitMap {
|
|||
// An integer divide by 64 is equivalent to a shift of 6 bits if the integer is
|
||||
// positive.
|
||||
// We do not explicitly check for a negative here. Instead we use a
|
||||
// a signed shift. Any negative index will produce a negative value
|
||||
// signed shift. Any negative index will produce a negative value
|
||||
// by sign-extension and if used as an index into an array it will throw an
|
||||
// exception.
|
||||
return bitIndex >> DIVIDE_BY_64;
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.function.LongPredicate;
|
|||
|
||||
/**
|
||||
* A long predicate that applies the test func to each member of the @{code ary} in sequence for each call to @{code test()}.
|
||||
* if the @{code ary} is exhausted, the subsequent calls to to @{code test} are executed with a zero value.
|
||||
* if the @{code ary} is exhausted, the subsequent calls to @{code test} are executed with a zero value.
|
||||
* If the calls to @{code test} do not exhaust the @{code ary} the @{code forEachRemaining} method can be called to
|
||||
* execute the @code{text} with a zero value for each remaining @{code idx} value.
|
||||
*
|
||||
|
|
|
@ -415,7 +415,7 @@ public final class Shape {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculates the number of hash functions given numberOfItems and numberofBits.
|
||||
* Calculates the number of hash functions given numberOfItems and numberOfBits.
|
||||
* This is a method so that the calculation is consistent across all constructors.
|
||||
*
|
||||
* @param numberOfItems the number of items in the filter.
|
||||
|
@ -431,9 +431,9 @@ public final class Shape {
|
|||
throw new IllegalArgumentException(
|
||||
String.format("Filter too small: Calculated number of hash functions (%s) was less than 1", k));
|
||||
}
|
||||
// Normally we would check that numberofHashFunctions <= Integer.MAX_VALUE but
|
||||
// Normally we would check that numberOfHashFunctions <= Integer.MAX_VALUE but
|
||||
// since numberOfBits is at most Integer.MAX_VALUE the numerator of
|
||||
// numberofHashFunctions is ln(2) * Integer.MAX_VALUE = 646456992.9449 the
|
||||
// numberOfHashFunctions is ln(2) * Integer.MAX_VALUE = 646456992.9449 the
|
||||
// value of k can not be above Integer.MAX_VALUE.
|
||||
return (int) k;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue