Ignore:
Timestamp:
Oct 12, 2007, 5:47:57 AM (18 years ago)
Author:
oliver
Message:

Reviewed by Maciej.

Use intHash to hash floats and doubles too.

  • ChangeLog:
  • wtf/HashFunctions.h: (WTF::FloatHash::hash): (WTF::FloatHash::equal): (WTF::):
  • wtf/HashTraits.h: (WTF::FloatHashTraits::emptyValue): (WTF::FloatHashTraits::deletedValue): (WTF::):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/HashTraits.h

    r24059 r26417  
    9595    };
    9696   
     97    template<typename T> struct FloatHashTraits {
     98        typedef T TraitType;
     99        typedef HashTraits<T> StorageTraits;
     100        static T emptyValue() { return std::numeric_limits<T>::infinity(); }
     101        static T deletedValue() { return -std::numeric_limits<T>::infinity(); }
     102        static const bool emptyValueIsZero = false;
     103        static const bool needsDestruction = false;
     104        static const bool needsRef = false;
     105    };
     106    template<> struct HashTraits<float> : FloatHashTraits<float> {
     107    };
     108    template<> struct HashTraits<double> : FloatHashTraits<double> {
     109    };
     110
    97111    template<typename P> struct HashTraits<P*> : GenericHashTraits<P*> {
    98112        typedef HashTraits<typename IntTypes<sizeof(P*)>::SignedType> StorageTraits;
Note: See TracChangeset for help on using the changeset viewer.