mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-14 17:13:40 +00:00
[hash] Links
This commit is contained in:
parent
05567da082
commit
b2b15fa30a
2 changed files with 5 additions and 1 deletions
|
@ -315,7 +315,8 @@ struct
|
|||
impl (const T& v, hb_priority<2>) const HB_RETURN (uint32_t, hb_deref (v).hash ())
|
||||
|
||||
// Horrible: std:hash() of integers seems to be identity in gcc / clang?!
|
||||
//
|
||||
// https://github.com/harfbuzz/harfbuzz/pull/4228
|
||||
|
||||
template <typename T,
|
||||
hb_enable_if (std::is_integral<T>::value && sizeof (T) <= sizeof (uint32_t))> constexpr auto
|
||||
impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, v * 8388607u /* Mersenne prime */)
|
||||
|
|
|
@ -123,6 +123,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
|||
uint32_t hash () const
|
||||
{
|
||||
// FNV-1a hash function
|
||||
// https://github.com/harfbuzz/harfbuzz/pull/4228
|
||||
uint32_t current = /*cbf29ce4*/0x84222325;
|
||||
for (auto &v : *this)
|
||||
{
|
||||
|
@ -456,12 +457,14 @@ inline bool hb_array_t<const unsigned char>::operator == (const hb_array_t<const
|
|||
template <>
|
||||
inline uint32_t hb_array_t<const char>::hash () const
|
||||
{
|
||||
// https://github.com/harfbuzz/harfbuzz/pull/4228
|
||||
return fasthash32(arrayZ, length, 0xf437ffe6 /* magic? */);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline uint32_t hb_array_t<const unsigned char>::hash () const
|
||||
{
|
||||
// https://github.com/harfbuzz/harfbuzz/pull/4228
|
||||
return fasthash32(arrayZ, length, 0xf437ffe6 /* magic? */);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue