projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Updating Patrick's C++ exceptions to build without warnings on solaris.
[m6w6/libmemcached]
/
libmemcached
/
memcached_hash.c
diff --git
a/libmemcached/memcached_hash.c
b/libmemcached/memcached_hash.c
index 5abc1e0761731627bcc49b1caaf1401f7f32e18b..129d76127e8e7271a5d19861892da6b4c474addd 100644
(file)
--- a/
libmemcached/memcached_hash.c
+++ b/
libmemcached/memcached_hash.c
@@
-40,7
+40,7
@@
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
for (x= 0; x < key_length; x++)
{
temp_hash *= FNV_64_PRIME;
for (x= 0; x < key_length; x++)
{
temp_hash *= FNV_64_PRIME;
- temp_hash ^= key[x];
+ temp_hash ^=
(uint64_t)
key[x];
}
hash= (uint32_t)temp_hash;
}
}
hash= (uint32_t)temp_hash;
}
@@
-50,7
+50,8
@@
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
hash= (uint32_t) FNV_64_INIT;
for (x= 0; x < key_length; x++)
{
hash= (uint32_t) FNV_64_INIT;
for (x= 0; x < key_length; x++)
{
- hash ^= key[x];
+ uint32_t val= (uint32_t)key[x];
+ hash ^= val;
hash *= (uint32_t) FNV_64_PRIME;
}
}
hash *= (uint32_t) FNV_64_PRIME;
}
}
@@
-60,8
+61,9
@@
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
+ uint32_t val= (uint32_t)key[x];
hash *= FNV_32_PRIME;
hash *= FNV_32_PRIME;
- hash ^=
key[x]
;
+ hash ^=
val
;
}
}
break;
}
}
break;
@@
-70,7
+72,8
@@
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memca
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
hash= FNV_32_INIT;
for (x= 0; x < key_length; x++)
{
- hash ^= key[x];
+ uint32_t val= (uint32_t)key[x];
+ hash ^= val;
hash *= FNV_32_PRIME;
}
}
hash *= FNV_32_PRIME;
}
}
@@
-201,11
+204,12
@@
uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_
static uint32_t internal_generate_hash(const char *key, size_t key_length)
{
const char *ptr= key;
static uint32_t internal_generate_hash(const char *key, size_t key_length)
{
const char *ptr= key;
- int32_t value= 0;
+
u
int32_t value= 0;
while (key_length--)
{
while (key_length--)
{
- value += (int32_t) *ptr++;
+ uint32_t val= (uint32_t) *ptr++;
+ value += val;
value += (value << 10);
value ^= (value >> 6);
}
value += (value << 10);
value ^= (value >> 6);
}