10.6 compatibility: Fix some new compiler warnings, and work around apparent regressions in NSTask and -stringByStandardizingPath.
5 * This file created by Jens Alfke on 3/17/08.
6 * Algorithm & source code by Austin Appleby, released to public domain.
7 * <http://murmurhash.googlepages.com/>
8 * Downloaded 3/16/2008.
9 * Modified slightly by Jens Alfke (use standard uint32_t and size_t types;
10 * change 'm' and 'r' to #defines for better C compatibility.)
14 #include "MurmurHash.h"
17 //-----------------------------------------------------------------------------
18 // MurmurHash2, by Austin Appleby
20 // Note - This code makes a few assumptions about how your machine behaves -
22 // 1. We can read a 4-byte value from any address without crashing
23 // 2. sizeof(int) == 4 **Jens: I fixed this by changing 'unsigned int' to 'uint32_t'**
25 // And it has a few limitations -
27 // 1. It will not work incrementally.
28 // 2. It will not produce the same results on little-endian and big-endian
31 uint32_t MurmurHash2 ( const void * key, size_t len, uint32_t seed )
33 // 'm' and 'r' are mixing constants generated offline.
34 // They're not really 'magic', they just happen to work well.
39 // Initialize the hash to a 'random' value
41 uint32_t h = seed ^ len;
43 // Mix 4 bytes at a time into the hash
45 const unsigned char * data = (const unsigned char *)key;
49 uint32_t k = *(uint32_t *)data;
62 // Handle the last few bytes of the input array
66 case 3: h ^= data[2] << 16;
67 case 2: h ^= data[1] << 8;
72 // Do a few final mixes of the hash to ensure the last few
73 // bytes are well-incorporated.