X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fhash.c;h=c1feb6676995e4dad7de26acf4fa1f83e65f45e7;hb=3e145c601836a25495d6656491f69eafd7212dd4;hp=23bdbbe4e66bacc69b5f6187acebe0c368541937;hpb=94a7163d4e9d7c79ea032c54f4a222038d604342;p=wget diff --git a/src/hash.c b/src/hash.c index 23bdbbe4..c1feb667 100644 --- a/src/hash.c +++ b/src/hash.c @@ -170,7 +170,7 @@ struct hash_table { -1. This is acceptable because it still allows the use of nonnegative integer keys. */ -#define INVALID_PTR ((void *) ~0UL) +#define INVALID_PTR ((void *) ~(uintptr_t) 0) #ifndef UCHAR_MAX # define UCHAR_MAX 0xff #endif @@ -709,7 +709,7 @@ make_nocase_string_hash_table (int items) unsigned long hash_pointer (const void *ptr) { - unsigned long key = (unsigned long) ptr; + uintptr_t key = (uintptr_t) ptr; key += (key << 12); key ^= (key >> 22); key += (key << 4); @@ -718,7 +718,7 @@ hash_pointer (const void *ptr) key ^= (key >> 2); key += (key << 7); key ^= (key >> 12); -#if SIZEOF_LONG > 4 +#if SIZEOF_VOID_P > 4 key += (key << 44); key ^= (key >> 54); key += (key << 36); @@ -728,7 +728,7 @@ hash_pointer (const void *ptr) key += (key << 39); key ^= (key >> 44); #endif - return key; + return (unsigned long) key; } static int