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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 */ | 53 */ |
54 int slowFindIndex(T* elem) const { return fSorted.find(elem); } | 54 int slowFindIndex(T* elem) const { return fSorted.find(elem); } |
55 | 55 |
56 #if GR_DEBUG | 56 #if GR_DEBUG |
57 void validate() const; | 57 void validate() const; |
58 bool contains(T*) const; | 58 bool contains(T*) const; |
59 #endif | 59 #endif |
60 | 60 |
61 // testing | 61 // testing |
62 const SkTDArray<T*>& getArray() const { return fSorted; } | 62 const SkTDArray<T*>& getArray() const { return fSorted; } |
| 63 SkTDArray<T*>& getArray() { return fSorted; } |
63 private: | 64 private: |
64 enum { | 65 enum { |
65 kHashCount = 1 << kHashBits, | 66 kHashCount = 1 << kHashBits, |
66 kHashMask = kHashCount - 1 | 67 kHashMask = kHashCount - 1 |
67 }; | 68 }; |
68 static unsigned hash2Index(uint32_t hash) { | 69 static unsigned hash2Index(uint32_t hash) { |
69 hash ^= hash >> 16; | 70 hash ^= hash >> 16; |
70 if (kHashBits <= 8) { | 71 if (kHashBits <= 8) { |
71 hash ^= hash >> 8; | 72 hash ^= hash >> 8; |
72 } | 73 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 237 |
237 template <typename T, typename Key, size_t kHashBits> | 238 template <typename T, typename Key, size_t kHashBits> |
238 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { | 239 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { |
239 int index = fSorted.find(elem); | 240 int index = fSorted.find(elem); |
240 return index >= 0; | 241 return index >= 0; |
241 } | 242 } |
242 | 243 |
243 #endif | 244 #endif |
244 | 245 |
245 #endif | 246 #endif |
OLD | NEW |