nxt_murmur_hash.c (39:e7e3deeaa09b) nxt_murmur_hash.c (611:323e11065f83)
1
2/*
3 * The code is based on the code by Austin Appleby,
4 * released to the public domain.
5 */
6
7#include <nxt_main.h>
8
9
10uint32_t
11nxt_murmur_hash2(const void *data, size_t len)
12{
13 uint32_t h, k;
14 const u_char *p;
1
2/*
3 * The code is based on the code by Austin Appleby,
4 * released to the public domain.
5 */
6
7#include <nxt_main.h>
8
9
10uint32_t
11nxt_murmur_hash2(const void *data, size_t len)
12{
13 uint32_t h, k;
14 const u_char *p;
15 const uint32_t m = 0x5bd1e995;
15 const uint32_t m = 0x5BD1E995;
16
17 p = data;
18 h = 0 ^ (uint32_t) len;
19
20 while (len >= 4) {
21 k = p[0];
22 k |= p[1] << 8;
23 k |= p[2] << 16;

--- 32 unchanged lines hidden (view full) ---

56
57/* The MurmurHash2 for fixed 4 byte length. */
58
59uint32_t
60nxt_murmur_hash2_uint32(const void *data)
61{
62 uint32_t h, k;
63 const u_char *p;
16
17 p = data;
18 h = 0 ^ (uint32_t) len;
19
20 while (len >= 4) {
21 k = p[0];
22 k |= p[1] << 8;
23 k |= p[2] << 16;

--- 32 unchanged lines hidden (view full) ---

56
57/* The MurmurHash2 for fixed 4 byte length. */
58
59uint32_t
60nxt_murmur_hash2_uint32(const void *data)
61{
62 uint32_t h, k;
63 const u_char *p;
64 const uint32_t m = 0x5bd1e995;
64 const uint32_t m = 0x5BD1E995;
65
66 p = data;
67
68 k = p[0];
69 k |= p[1] << 8;
70 k |= p[2] << 16;
71 k |= p[3] << 24;
72

--- 14 unchanged lines hidden ---
65
66 p = data;
67
68 k = p[0];
69 k |= p[1] << 8;
70 k |= p[2] << 16;
71 k |= p[3] << 24;
72

--- 14 unchanged lines hidden ---