Remove invalid use of register

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-09-19 22:59:39 -07:00
parent 49e87ccbb1
commit 16dc056abc

View file

@ -21,7 +21,7 @@ void mix(unsigned & a, unsigned & b, unsigned & c) {
// Bob Jenkin's hash function.
// http://burtleburtle.net/bob/hash/doobs.html
unsigned hash_str(unsigned length, char const * str, unsigned init_value) {
register unsigned a, b, c, len;
unsigned a, b, c, len;
/* Set up the internal state */
len = length;
@ -33,10 +33,7 @@ unsigned hash_str(unsigned length, char const * str, unsigned init_value) {
a += reinterpret_cast<unsigned const *>(str)[0];
b += reinterpret_cast<unsigned const *>(str)[1];
c += reinterpret_cast<unsigned const *>(str)[2];
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
mix(a, b, c);
#pragma GCC diagnostic pop
str += 12; len -= 12;
}
@ -58,10 +55,7 @@ unsigned hash_str(unsigned length, char const * str, unsigned init_value) {
case 1 : a+=str[0];
/* case 0: nothing left to add */
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
mix(a, b, c);
#pragma GCC diagnostic pop
mix(a, b, c);
/*-------------------------------------------- report the result */
return c;
}