Changeset 19631 in webkit for trunk/JavaScriptCore/wtf/Vector.h
- Timestamp:
- Feb 14, 2007, 3:42:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/Vector.h
r19613 r19631 177 177 }; 178 178 179 template<bool canCompareWithMemcmp, typename T> 180 class VectorComparer; 181 182 template<typename T> 183 struct VectorComparer<false, T> 184 { 185 static bool compare(const T* a, const T* b, size_t size) 186 { 187 for (size_t i = 0; i < size; ++i) 188 if (a[i] != b[i]) 189 return false; 190 return false; 191 } 192 }; 193 194 template<typename T> 195 struct VectorComparer<true, T> 196 { 197 static bool compare(const T* a, const T* b, size_t size) 198 { 199 return memcmp(a, b, sizeof(T) * size) == 0; 200 } 201 }; 202 179 203 template<typename T> 180 204 struct VectorTypeOperations … … 208 232 { 209 233 VectorFiller<VectorTraits<T>::canFillWithMemset, T>::uninitializedFill(dst, dstEnd, val); 234 } 235 236 static bool compare(const T* a, const T* b, size_t size) 237 { 238 return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size); 210 239 } 211 240 }; … … 669 698 return false; 670 699 671 for (size_t i = 0; i < a.size(); ++i) 672 if (a.at(i) != b.at(i)) 673 return false; 674 675 return true; 700 return VectorTypeOperations<T>::compare(a.data(), b.data(), a.size()); 676 701 } 677 702
Note:
See TracChangeset
for help on using the changeset viewer.