summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorEsun Kim <veblush@google.com>2019-08-09 08:48:57 -0700
committerEsun Kim <veblush@google.com>2019-08-09 08:48:57 -0700
commit6f9a9fb2faa61e7cbd3949ee4590967e0eb0dee8 (patch)
treea59e054a31e37757e522f33867b51693379e3a1a /upb
parentb70f68269a7d51c5ce372a93742bf6960215ffef (diff)
Rename MurmurHash2 to upb_murmur_hash2
Diffstat (limited to 'upb')
-rw-r--r--upb/table.c12
-rw-r--r--upb/table.int.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/upb/table.c b/upb/table.c
index 9f8c59f..13f8d81 100644
--- a/upb/table.c
+++ b/upb/table.c
@@ -283,7 +283,7 @@ static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) {
static uint32_t strhash(upb_tabkey key) {
uint32_t len;
char *str = upb_tabstr(key, &len);
- return MurmurHash2(str, len, 0);
+ return upb_murmur_hash2(str, len, 0);
}
static bool streql(upb_tabkey k1, lookupkey_t k2) {
@@ -344,20 +344,20 @@ bool upb_strtable_insert3(upb_strtable *t, const char *k, size_t len,
tabkey = strcopy(key, a);
if (tabkey == 0) return false;
- hash = MurmurHash2(key.str.str, key.str.len, 0);
+ hash = upb_murmur_hash2(key.str.str, key.str.len, 0);
insert(&t->t, key, tabkey, v, hash, &strhash, &streql);
return true;
}
bool upb_strtable_lookup2(const upb_strtable *t, const char *key, size_t len,
upb_value *v) {
- uint32_t hash = MurmurHash2(key, len, 0);
+ uint32_t hash = upb_murmur_hash2(key, len, 0);
return lookup(&t->t, strkey2(key, len), v, hash, &streql);
}
bool upb_strtable_remove3(upb_strtable *t, const char *key, size_t len,
upb_value *val, upb_alloc *alloc) {
- uint32_t hash = MurmurHash2(key, len, 0);
+ uint32_t hash = upb_murmur_hash2(key, len, 0);
upb_tabkey tabkey;
if (rm(&t->t, strkey2(key, len), val, &tabkey, hash, &streql)) {
upb_free(alloc, (void*)tabkey);
@@ -743,7 +743,7 @@ bool upb_inttable_iter_isequal(const upb_inttable_iter *i1,
* 1. It will not work incrementally.
* 2. It will not produce the same results on little-endian and big-endian
* machines. */
-uint32_t MurmurHash2(const void *key, size_t len, uint32_t seed) {
+uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) {
/* 'm' and 'r' are mixing constants generated offline.
* They're not really 'magic', they just happen to work well. */
const uint32_t m = 0x5bd1e995;
@@ -794,7 +794,7 @@ uint32_t MurmurHash2(const void *key, size_t len, uint32_t seed) {
#define MIX(h,k,m) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
-uint32_t MurmurHash2(const void * key, size_t len, uint32_t seed) {
+uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed) {
const uint32_t m = 0x5bd1e995;
const int32_t r = 24;
const uint8_t * data = (const uint8_t *)key;
diff --git a/upb/table.int.h b/upb/table.int.h
index 762d449..23b0b2f 100644
--- a/upb/table.int.h
+++ b/upb/table.int.h
@@ -245,7 +245,7 @@ UPB_INLINE bool upb_tabent_isempty(const upb_tabent *e) {
}
/* Used by some of the unit tests for generic hashing functionality. */
-uint32_t MurmurHash2(const void * key, size_t len, uint32_t seed);
+uint32_t upb_murmur_hash2(const void * key, size_t len, uint32_t seed);
UPB_INLINE uintptr_t upb_intkey(uintptr_t key) {
return key;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback