diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-02-04 14:54:44 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-02-04 14:54:44 +0100 |
commit | 7b992b88818a931665441c3fb0f0c16824116567 (patch) | |
tree | 66d6ff52ed406bad1b0017deac104e96189a2c52 /vespajlib | |
parent | e67031fd521c68ca66fdf897f8c6b0fd5a395f45 (diff) |
Add hash function
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/collections/BobHash.java | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/collections/BobHash.java b/vespajlib/src/main/java/com/yahoo/collections/BobHash.java index d133af2ea84..3d1e82743cc 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/BobHash.java +++ b/vespajlib/src/main/java/com/yahoo/collections/BobHash.java @@ -153,44 +153,45 @@ public class BobHash { // handle the last 11 bytes c += k.length; switch (len) { - // all the case statements fall through - case 11: - c += (unsign(k[offset + 10]) << 24); + // all the case statements fall through + case 11: + c += (unsign(k[offset + 10]) << 24); - case 10: - c += (unsign(k[offset + 9]) << 16); + case 10: + c += (unsign(k[offset + 9]) << 16); - case 9: - c += (unsign(k[offset + 8]) << 8); + case 9: + c += (unsign(k[offset + 8]) << 8); - /* the first byte of c is reserved for the length */ - case 8: - b += (unsign(k[offset + 7]) << 24); + /* the first byte of c is reserved for the length */ + case 8: + b += (unsign(k[offset + 7]) << 24); - case 7: - b += (unsign(k[offset + 6]) << 16); + case 7: + b += (unsign(k[offset + 6]) << 16); - case 6: - b += (unsign(k[offset + 5]) << 8); + case 6: + b += (unsign(k[offset + 5]) << 8); - case 5: - b += unsign(k[offset + 4]); + case 5: + b += unsign(k[offset + 4]); - case 4: - a += (unsign(k[offset + 3]) << 24); + case 4: + a += (unsign(k[offset + 3]) << 24); - case 3: - a += (unsign(k[offset + 2]) << 16); + case 3: + a += (unsign(k[offset + 2]) << 16); - case 2: - a += (unsign(k[offset + 1]) << 8); + case 2: + a += (unsign(k[offset + 1]) << 8); - case 1: - a += unsign(k[offset + 0]); + case 1: + a += unsign(k[offset + 0]); - /* case 0: nothing left to add */ + /* case 0: nothing left to add */ } abcBuffer = mix(a, b, c); return abcBuffer[2]; } + } |