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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 // testing | 52 // testing |
53 const SkTDArray<T*>& getArray() const { return fSorted; } | 53 const SkTDArray<T*>& getArray() const { return fSorted; } |
54 SkTDArray<T*>& getArray() { return fSorted; } | 54 SkTDArray<T*>& getArray() { return fSorted; } |
55 private: | 55 private: |
56 void clearHash() { sk_bzero(fHash, sizeof(fHash)); } | 56 void clearHash() { sk_bzero(fHash, sizeof(fHash)); } |
57 | 57 |
58 enum { | 58 enum { |
59 kHashCount = 1 << kHashBits, | 59 kHashCount = 1 << kHashBits, |
60 kHashMask = kHashCount - 1 | 60 kHashMask = kHashCount - 1 |
61 }; | 61 }; |
62 static unsigned hash2Index(uint32_t hash) { | 62 static unsigned hash2Index(intptr_t hash) { |
bsalomon
2013/10/29 14:40:36
really?
| |
63 hash ^= hash >> 16; | 63 hash ^= hash >> 16; |
64 if (kHashBits <= 8) { | 64 if (kHashBits <= 8) { |
65 hash ^= hash >> 8; | 65 hash ^= hash >> 8; |
66 } | 66 } |
67 return hash & kHashMask; | 67 return hash & kHashMask; |
68 } | 68 } |
69 | 69 |
70 mutable T* fHash[kHashCount]; | 70 mutable T* fHash[kHashCount]; |
71 SkTDArray<T*> fSorted; | 71 SkTDArray<T*> fSorted; |
72 | 72 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 | 199 |
200 template <typename T, typename Key, size_t kHashBits> | 200 template <typename T, typename Key, size_t kHashBits> |
201 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { | 201 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { |
202 int index = fSorted.find(elem); | 202 int index = fSorted.find(elem); |
203 return index >= 0; | 203 return index >= 0; |
204 } | 204 } |
205 | 205 |
206 #endif | 206 #endif |
207 | 207 |
208 #endif | 208 #endif |
OLD | NEW |