murmurhash3 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/murmurhash3/murmur3.c +11 -4
- data/lib/murmurhash3/version.rb +1 -1
- metadata +2 -2
data/ext/murmurhash3/murmur3.c
CHANGED
@@ -11,11 +11,13 @@
|
|
11
11
|
|
12
12
|
typedef unsigned char uint8_t;
|
13
13
|
typedef unsigned int uint32_t;
|
14
|
+
#ifndef HAVE_STDINT_H
|
14
15
|
#if SIZEOF_LONG == 8
|
15
16
|
typedef unsigned long uint64_t;
|
16
17
|
#else
|
17
18
|
typedef unsigned long long uint64_t;
|
18
19
|
#endif
|
20
|
+
#endif
|
19
21
|
|
20
22
|
/*-----------------------------------------------------------------------------
|
21
23
|
* Platform-specific functions and macros
|
@@ -61,6 +63,11 @@ rotl64 ( uint64_t x, int8_t r )
|
|
61
63
|
/* Block read - if your platform needs to do endian-swapping or can only
|
62
64
|
* handle aligned reads, do the conversion here */
|
63
65
|
#ifdef WORDS_BIGENDIAN
|
66
|
+
#define GCC_VERSION_SINCE(major, minor, patchlevel) \
|
67
|
+
(defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
|
68
|
+
((__GNUC__ > (major)) || \
|
69
|
+
(__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
|
70
|
+
(__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
|
64
71
|
#if GCC_VERSION_SINCE(4,3,0)
|
65
72
|
# define swap32(x) __builtin_bswap32(x)
|
66
73
|
# define swap64(x) __builtin_bswap64(x)
|
@@ -137,10 +144,10 @@ mmix32(uint32_t k1)
|
|
137
144
|
}
|
138
145
|
|
139
146
|
static uint32_t
|
140
|
-
MurmurHash3_x86_32 ( const void * key,
|
147
|
+
MurmurHash3_x86_32 ( const void * key, long len, uint32_t seed)
|
141
148
|
{
|
142
149
|
const uint8_t * data = (const uint8_t*)key;
|
143
|
-
const int nblocks = len / 4;
|
150
|
+
const int nblocks = (int)(len / 4);
|
144
151
|
int i;
|
145
152
|
|
146
153
|
uint32_t h1 = seed;
|
@@ -198,11 +205,11 @@ mmix128_2(uint64_t k2)
|
|
198
205
|
return k2 * C1_128;
|
199
206
|
}
|
200
207
|
|
201
|
-
static void MurmurHash3_x64_128 ( const void * key, const
|
208
|
+
static void MurmurHash3_x64_128 ( const void * key, const long len,
|
202
209
|
const uint32_t seed, void * out )
|
203
210
|
{
|
204
211
|
const uint8_t * data = (const uint8_t*)key;
|
205
|
-
const int nblocks = len / 16;
|
212
|
+
const int nblocks = (int)(len / 16);
|
206
213
|
int i;
|
207
214
|
|
208
215
|
uint64_t h1 = seed;
|
data/lib/murmurhash3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: murmurhash3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: implementation of murmur3 hashing function
|
15
15
|
email:
|