diff --git a/src/hb-algs.hh b/src/hb-algs.hh index e34885fe2..5629d7594 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -307,12 +307,6 @@ static inline uint32_t fasthash32(const void *buf, size_t len, uint32_t seed) return h - (h >> 32); } -template // This line speeds things up. Go figure... -static inline uint32_t _hb_hash32 (uint32_t v) -{ - return fasthash32 (&v, sizeof (v), 0); -} - struct { private: @@ -324,11 +318,11 @@ struct // template ::value && sizeof (T) <= sizeof (uint32_t))> constexpr auto - impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, _hb_hash32 (v)) + impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, v * 8388607u /* Mersenne prime */) template ::value && sizeof (T) > sizeof (uint32_t))> constexpr auto - impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, _hb_hash32 (v) ^ _hb_hash32 (v >> 32)) + impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, (v * 8388607u) ^ ((v >> 32) * 8388607u) /* Mersenne prime */) template constexpr auto impl (const T& v, hb_priority<0>) const HB_RETURN (uint32_t, std::hash>{} (hb_deref (v)))