| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // testing | 54 // testing |
| 55 const SkTDArray<T*>& getArray() const { return fSorted; } | 55 const SkTDArray<T*>& getArray() const { return fSorted; } |
| 56 SkTDArray<T*>& getArray() { return fSorted; } | 56 SkTDArray<T*>& getArray() { return fSorted; } |
| 57 private: | 57 private: |
| 58 void clearHash() { sk_bzero(fHash, sizeof(fHash)); } | 58 void clearHash() { sk_bzero(fHash, sizeof(fHash)); } |
| 59 | 59 |
| 60 enum { | 60 enum { |
| 61 kHashCount = 1 << kHashBits, | 61 kHashCount = 1 << kHashBits, |
| 62 kHashMask = kHashCount - 1 | 62 kHashMask = kHashCount - 1 |
| 63 }; | 63 }; |
| 64 static unsigned hash2Index(uint32_t hash) { | 64 static unsigned hash2Index(intptr_t hash) { |
| 65 if (sizeof(hash) == 8) { |
| 66 hash ^= hash >> 32; |
| 67 } |
| 65 hash ^= hash >> 16; | 68 hash ^= hash >> 16; |
| 66 if (kHashBits <= 8) { | 69 if (kHashBits <= 8) { |
| 67 hash ^= hash >> 8; | 70 hash ^= hash >> 8; |
| 68 } | 71 } |
| 69 return hash & kHashMask; | 72 return hash & kHashMask; |
| 70 } | 73 } |
| 71 | 74 |
| 72 mutable T* fHash[kHashCount]; | 75 mutable T* fHash[kHashCount]; |
| 73 SkTDArray<T*> fSorted; | 76 SkTDArray<T*> fSorted; |
| 74 | 77 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 204 |
| 202 template <typename T, typename Key, size_t kHashBits> | 205 template <typename T, typename Key, size_t kHashBits> |
| 203 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { | 206 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { |
| 204 int index = fSorted.find(elem); | 207 int index = fSorted.find(elem); |
| 205 return index >= 0; | 208 return index >= 0; |
| 206 } | 209 } |
| 207 | 210 |
| 208 #endif | 211 #endif |
| 209 | 212 |
| 210 #endif | 213 #endif |
| OLD | NEW |