Changeset 36244 in webkit for trunk/JavaScriptCore/wtf/HashTraits.h
- Timestamp:
- Sep 6, 2008, 10:44:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/HashTraits.h
r35900 r36244 82 82 }; 83 83 84 // default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned)84 // Default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned). 85 85 template<typename T> struct GenericHashTraitsBase<true, T> { 86 86 static const bool emptyValueIsZero = true; … … 106 106 template<> struct HashTraits<float> : FloatHashTraits<float> { }; 107 107 template<> struct HashTraits<double> : FloatHashTraits<double> { }; 108 109 // Default unsigned traits disallow both 0 and max as keys -- use these traits to allow zero and disallow max - 1. 110 template<typename T> struct UnsignedWithZeroKeyHashTraits : GenericHashTraits<T> { 111 static const bool emptyValueIsZero = false; 112 static const bool needsDestruction = false; 113 static T emptyValue() { return std::numeric_limits<T>::max(); } 114 static void constructDeletedValue(T& slot) { slot = std::numeric_limits<T>::max() - 1; } 115 static bool isDeletedValue(T value) { return value == std::numeric_limits<T>::max() - 1; } 116 }; 108 117 109 118 template<typename P> struct HashTraits<P*> : GenericHashTraits<P*> {
Note:
See TracChangeset
for help on using the changeset viewer.