]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/util/murmurhash.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
7 Murmurhash from http://sites.google.com/site/murmurhash/
9 All code is released to the public domain. For business purposes, Murmurhash is
10 under the MIT license.
14 #include "rocksdb/slice.h"
16 #if defined(__x86_64__)
17 #define MURMUR_HASH MurmurHash64A
18 uint64_t MurmurHash64A ( const void * key
, int len
, unsigned int seed
);
19 #define MurmurHash MurmurHash64A
20 typedef uint64_t murmur_t
;
22 #elif defined(__i386__)
23 #define MURMUR_HASH MurmurHash2
24 unsigned int MurmurHash2 ( const void * key
, int len
, unsigned int seed
);
25 #define MurmurHash MurmurHash2
26 typedef unsigned int murmur_t
;
29 #define MURMUR_HASH MurmurHashNeutral2
30 unsigned int MurmurHashNeutral2 ( const void * key
, int len
, unsigned int seed
);
31 #define MurmurHash MurmurHashNeutral2
32 typedef unsigned int murmur_t
;
35 // Allow slice to be hashable by murmur hash.
38 size_t operator()(const Slice
& slice
) const {
39 return MurmurHash(slice
.data(), static_cast<int>(slice
.size()), 0);