You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
HarfBuzz: Update to version 8.0.0
This commit is contained in:
70
thirdparty/harfbuzz/src/hb-array.hh
vendored
70
thirdparty/harfbuzz/src/hb-array.hh
vendored
@@ -75,11 +75,25 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||
*/
|
||||
typedef Type& __item_t__;
|
||||
static constexpr bool is_random_access_iterator = true;
|
||||
static constexpr bool has_fast_len = true;
|
||||
Type& __item__ () const
|
||||
{
|
||||
if (unlikely (!length)) return CrapOrNull (Type);
|
||||
return *arrayZ;
|
||||
}
|
||||
Type& __item_at__ (unsigned i) const
|
||||
{
|
||||
if (unlikely (i >= length)) return CrapOrNull (Type);
|
||||
return arrayZ[i];
|
||||
}
|
||||
void __next__ ()
|
||||
{
|
||||
if (unlikely (!length))
|
||||
return;
|
||||
length--;
|
||||
backwards_length++;
|
||||
arrayZ++;
|
||||
}
|
||||
void __forward__ (unsigned n)
|
||||
{
|
||||
if (unlikely (n > length))
|
||||
@@ -88,6 +102,14 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||
backwards_length += n;
|
||||
arrayZ += n;
|
||||
}
|
||||
void __prev__ ()
|
||||
{
|
||||
if (unlikely (!backwards_length))
|
||||
return;
|
||||
length++;
|
||||
backwards_length--;
|
||||
arrayZ--;
|
||||
}
|
||||
void __rewind__ (unsigned n)
|
||||
{
|
||||
if (unlikely (n > backwards_length))
|
||||
@@ -123,6 +145,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)
|
||||
{
|
||||
@@ -326,6 +349,7 @@ struct hb_sorted_array_t :
|
||||
HB_ITER_USING (iter_base_t);
|
||||
static constexpr bool is_random_access_iterator = true;
|
||||
static constexpr bool is_sorted_iterator = true;
|
||||
static constexpr bool has_fast_len = true;
|
||||
|
||||
hb_sorted_array_t () = default;
|
||||
hb_sorted_array_t (const hb_sorted_array_t&) = default;
|
||||
@@ -453,55 +477,21 @@ inline bool hb_array_t<const unsigned char>::operator == (const hb_array_t<const
|
||||
|
||||
/* Specialize hash() for byte arrays. */
|
||||
|
||||
#ifndef HB_OPTIMIZE_SIZE_MORE
|
||||
template <>
|
||||
inline uint32_t hb_array_t<const char>::hash () const
|
||||
{
|
||||
// FNV-1a hash function
|
||||
uint32_t current = /*cbf29ce4*/0x84222325;
|
||||
unsigned i = 0;
|
||||
|
||||
#if defined(__OPTIMIZE__) && !defined(HB_NO_PACKED) && \
|
||||
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__))
|
||||
struct __attribute__((packed)) packed_uint32_t { uint32_t v; };
|
||||
for (; i + 4 <= this->length; i += 4)
|
||||
{
|
||||
current = current ^ hb_hash ((uint32_t) ((const packed_uint32_t *) &this->arrayZ[i])->v);
|
||||
current = current * 16777619;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; i < this->length; i++)
|
||||
{
|
||||
current = current ^ hb_hash (this->arrayZ[i]);
|
||||
current = current * 16777619;
|
||||
}
|
||||
return current;
|
||||
// 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
|
||||
{
|
||||
// FNV-1a hash function
|
||||
uint32_t current = /*cbf29ce4*/0x84222325;
|
||||
unsigned i = 0;
|
||||
|
||||
#if defined(__OPTIMIZE__) && !defined(HB_NO_PACKED) && \
|
||||
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__))
|
||||
struct __attribute__((packed)) packed_uint32_t { uint32_t v; };
|
||||
for (; i + 4 <= this->length; i += 4)
|
||||
{
|
||||
current = current ^ hb_hash ((uint32_t) ((const packed_uint32_t *) &this->arrayZ[i])->v);
|
||||
current = current * 16777619;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; i < this->length; i++)
|
||||
{
|
||||
current = current ^ hb_hash (this->arrayZ[i]);
|
||||
current = current * 16777619;
|
||||
}
|
||||
return current;
|
||||
// https://github.com/harfbuzz/harfbuzz/pull/4228
|
||||
return fasthash32(arrayZ, length, 0xf437ffe6 /* magic? */);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
typedef hb_array_t<const char> hb_bytes_t;
|
||||
|
||||
Reference in New Issue
Block a user