OLD | NEW |
1 // From http://www.azillionmonkeys.com/qed/hash.html | 1 // From http://www.azillionmonkeys.com/qed/hash.html |
2 | 2 |
3 #include "net/disk_cache/hash.h" | 3 #include "base/hash.h" |
4 | 4 |
5 typedef uint32 uint32_t; | 5 typedef uint32 uint32_t; |
6 typedef uint16 uint16_t; | 6 typedef uint16 uint16_t; |
7 | 7 |
8 namespace disk_cache { | 8 namespace base { |
9 | 9 |
10 #undef get16bits | 10 #undef get16bits |
11 #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ | 11 #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ |
12 || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) | 12 || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) |
13 #define get16bits(d) (*((const uint16_t *) (d))) | 13 #define get16bits(d) (*((const uint16_t *) (d))) |
14 #endif | 14 #endif |
15 | 15 |
16 #if !defined (get16bits) | 16 #if !defined (get16bits) |
17 #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ | 17 #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ |
18 +(uint32_t)(((const uint8_t *)(d))[0]) ) | 18 +(uint32_t)(((const uint8_t *)(d))[0]) ) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 hash ^= hash << 3; | 63 hash ^= hash << 3; |
64 hash += hash >> 5; | 64 hash += hash >> 5; |
65 hash ^= hash << 4; | 65 hash ^= hash << 4; |
66 hash += hash >> 17; | 66 hash += hash >> 17; |
67 hash ^= hash << 25; | 67 hash ^= hash << 25; |
68 hash += hash >> 6; | 68 hash += hash >> 6; |
69 | 69 |
70 return hash; | 70 return hash; |
71 } | 71 } |
72 | 72 |
73 } // namespace disk_cache | 73 } // namespace base |
OLD | NEW |