Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamvishu committed Sep 22, 2024
1 parent c8ed113 commit b87a68c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ private FuzzySet(FixedBitSet filter, int bloomSize, int hashCount) {
public ContainsResult contains(BytesRef value) {
long[] hash = StringHelper.murmurhash3_x64_128(value);

int msb = ((int) hash[0] >>> Integer.SIZE) >>> 1 + ((int) hash[1] >>> Integer.SIZE) >>> 1;
int lsb = ((int) hash[0]) >>> 1 + ((int) hash[1]) >>> 1;
int msb = (((int) hash[0] >>> Integer.SIZE) >>> 1) + (((int) hash[1] >>> Integer.SIZE) >>> 1);
int lsb = ((int) hash[0] >>> 1) + ((int) hash[1] >>> 1);
for (int i = 0; i < hashCount; i++) {
int bloomPos = (lsb + i * msb);
if (!mayContainValue(bloomPos)) {
Expand Down Expand Up @@ -219,8 +219,8 @@ private boolean mayContainValue(int aHash) {
*/
public void addValue(BytesRef value) {
long[] hash = StringHelper.murmurhash3_x64_128(value);
int msb = ((int) hash[0] >>> Integer.SIZE) >>> 1 + ((int) hash[1] >>> Integer.SIZE) >>> 1;
int lsb = ((int) hash[0]) >>> 1 + ((int) hash[1]) >>> 1;
int msb = (((int) hash[0] >>> Integer.SIZE) >>> 1) + (((int) hash[1] >>> Integer.SIZE) >>> 1);
int lsb = ((int) hash[0] >>> 1) + ((int) hash[1] >>> 1);
for (int i = 0; i < hashCount; i++) {
// Bitmasking using bloomSize is effectively a modulo operation.
int bloomPos = (lsb + i * msb) & bloomSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private static long[] murmurhash3_x64_128(
long k1 = 0;
long k2 = 0;
final int index = offset + (nblocks << 4);
switch (offset + length - index) {
switch (length & 0x0F) {
case 15:
k2 ^= ((long) data[index + 14] & 0xff) << 48;
case 14:
Expand Down

0 comments on commit b87a68c

Please sign in to comment.