From da8aedfc171843388a1743b107dea5a98a6ab6eb Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:01:30 +0200 Subject: HarfBuzz: Update to version 3.1.1 --- thirdparty/harfbuzz/src/hb-algs.hh | 99 +++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 43 deletions(-) (limited to 'thirdparty/harfbuzz/src/hb-algs.hh') diff --git a/thirdparty/harfbuzz/src/hb-algs.hh b/thirdparty/harfbuzz/src/hb-algs.hh index bbe097fe01..446d87e28b 100644 --- a/thirdparty/harfbuzz/src/hb-algs.hh +++ b/thirdparty/harfbuzz/src/hb-algs.hh @@ -34,6 +34,9 @@ #include "hb-null.hh" #include "hb-number.hh" +#include +#include +#include /* * Flags @@ -125,7 +128,7 @@ struct BEInt template struct BEInt { - static_assert (!hb_is_signed (Type), ""); + static_assert (!std::is_signed::value, ""); public: BEInt () = default; constexpr BEInt (Type V) : v {uint8_t ((V >> 16) & 0xFF), @@ -179,7 +182,7 @@ struct { /* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */ template constexpr auto - operator () (T&& v) const HB_AUTO_RETURN ( hb_forward (v) ) + operator () (T&& v) const HB_AUTO_RETURN ( std::forward (v) ) } HB_FUNCOBJ (hb_identity); struct @@ -203,7 +206,7 @@ HB_FUNCOBJ (hb_ridentity); struct { template constexpr bool - operator () (T&& v) const { return bool (hb_forward (v)); } + operator () (T&& v) const { return bool (std::forward (v)); } } HB_FUNCOBJ (hb_bool); @@ -215,7 +218,7 @@ struct impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ()) template constexpr auto + hb_enable_if (std::is_integral::value)> constexpr auto impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN ( /* Knuth's multiplicative method: */ @@ -237,26 +240,26 @@ struct /* Pointer-to-member-function. */ template auto impl (Appl&& a, hb_priority<2>, T &&v, Ts&&... ds) const HB_AUTO_RETURN - ((hb_deref (hb_forward (v)).*hb_forward (a)) (hb_forward (ds)...)) + ((hb_deref (std::forward (v)).*std::forward (a)) (std::forward (ds)...)) /* Pointer-to-member. */ template auto impl (Appl&& a, hb_priority<1>, T &&v) const HB_AUTO_RETURN - ((hb_deref (hb_forward (v))).*hb_forward (a)) + ((hb_deref (std::forward (v))).*std::forward (a)) /* Operator(). */ template auto impl (Appl&& a, hb_priority<0>, Ts&&... ds) const HB_AUTO_RETURN - (hb_deref (hb_forward (a)) (hb_forward (ds)...)) + (hb_deref (std::forward (a)) (std::forward (ds)...)) public: template auto operator () (Appl&& a, Ts&&... ds) const HB_AUTO_RETURN ( - impl (hb_forward (a), + impl (std::forward (a), hb_prioritize, - hb_forward (ds)...) + std::forward (ds)...) ) } HB_FUNCOBJ (hb_invoke); @@ -275,9 +278,9 @@ struct hb_partial_t hb_declval (V), hb_declval (Ts)...)) { - return hb_invoke (hb_forward (a), - hb_forward (v), - hb_forward (ds)...); + return hb_invoke (std::forward (a), + std::forward (v), + std::forward (ds)...); } template (a), - hb_forward (d0), - hb_forward (v), - hb_forward (ds)...); + return hb_invoke (std::forward (a), + std::forward (d0), + std::forward (v), + std::forward (ds)...); } private: @@ -324,14 +327,14 @@ auto hb_partial (Appl&& a, V&& v) HB_AUTO_RETURN #define HB_PARTIALIZE(Pos) \ template \ decltype(auto) operator () (_T&& _v) const \ - { return hb_partial (this, hb_forward<_T> (_v)); } \ + { return hb_partial (this, std::forward<_T> (_v)); } \ static_assert (true, "") #else /* https://github.com/harfbuzz/harfbuzz/issues/1724 */ #define HB_PARTIALIZE(Pos) \ template \ auto operator () (_T&& _v) const HB_AUTO_RETURN \ - (hb_partial (+this, hb_forward<_T> (_v))) \ + (hb_partial (+this, std::forward<_T> (_v))) \ static_assert (true, "") #endif @@ -343,22 +346,22 @@ struct template auto impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN ( - hb_deref (hb_forward (p)).has (hb_forward (v)) + hb_deref (std::forward (p)).has (std::forward (v)) ) template auto impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN ( - hb_invoke (hb_forward (p), - hb_forward (v)) + hb_invoke (std::forward (p), + std::forward (v)) ) public: template auto operator () (Pred&& p, Val &&v) const HB_RETURN (bool, - impl (hb_forward (p), - hb_forward (v), + impl (std::forward (p), + std::forward (v), hb_prioritize) ) } @@ -371,22 +374,22 @@ struct template auto impl (Pred&& p, Val &&v, hb_priority<1>) const HB_AUTO_RETURN ( - hb_has (hb_forward (p), - hb_forward (v)) + hb_has (std::forward (p), + std::forward (v)) ) template auto impl (Pred&& p, Val &&v, hb_priority<0>) const HB_AUTO_RETURN ( - hb_forward (p) == hb_forward (v) + std::forward (p) == std::forward (v) ) public: template auto operator () (Pred&& p, Val &&v) const HB_RETURN (bool, - impl (hb_forward (p), - hb_forward (v), + impl (std::forward (p), + std::forward (v), hb_prioritize) ) } @@ -399,20 +402,20 @@ struct template auto impl (Proj&& f, Val &&v, hb_priority<2>) const HB_AUTO_RETURN ( - hb_deref (hb_forward (f)).get (hb_forward (v)) + hb_deref (std::forward (f)).get (std::forward (v)) ) template auto impl (Proj&& f, Val &&v, hb_priority<1>) const HB_AUTO_RETURN ( - hb_invoke (hb_forward (f), - hb_forward (v)) + hb_invoke (std::forward (f), + std::forward (v)) ) template auto impl (Proj&& f, Val &&v, hb_priority<0>) const HB_AUTO_RETURN ( - hb_forward (f)[hb_forward (v)] + std::forward (f)[std::forward (v)] ) public: @@ -420,8 +423,8 @@ struct template auto operator () (Proj&& f, Val &&v) const HB_AUTO_RETURN ( - impl (hb_forward (f), - hb_forward (v), + impl (std::forward (f), + std::forward (v), hb_prioritize) ) } @@ -434,19 +437,19 @@ struct template auto impl (T1&& v1, T2 &&v2, hb_priority<2>) const HB_AUTO_RETURN ( - hb_forward (v2).cmp (hb_forward (v1)) == 0 + std::forward (v2).cmp (std::forward (v1)) == 0 ) template auto impl (T1&& v1, T2 &&v2, hb_priority<1>) const HB_AUTO_RETURN ( - hb_forward (v1).cmp (hb_forward (v2)) == 0 + std::forward (v1).cmp (std::forward (v2)) == 0 ) template auto impl (T1&& v1, T2 &&v2, hb_priority<0>) const HB_AUTO_RETURN ( - hb_forward (v1) == hb_forward (v2) + std::forward (v1) == std::forward (v2) ) public: @@ -454,8 +457,8 @@ struct template auto operator () (T1&& v1, T2 &&v2) const HB_AUTO_RETURN ( - impl (hb_forward (v1), - hb_forward (v2), + impl (std::forward (v1), + std::forward (v2), hb_prioritize) ) } @@ -515,24 +518,34 @@ struct { template constexpr auto operator () (T&& a, T2&& b) const HB_AUTO_RETURN - (a <= b ? hb_forward (a) : hb_forward (b)) + (a <= b ? std::forward (a) : std::forward (b)) } HB_FUNCOBJ (hb_min); struct { template constexpr auto operator () (T&& a, T2&& b) const HB_AUTO_RETURN - (a >= b ? hb_forward (a) : hb_forward (b)) + (a >= b ? std::forward (a) : std::forward (b)) } HB_FUNCOBJ (hb_max); struct { template constexpr auto operator () (T&& x, T2&& min, T3&& max) const HB_AUTO_RETURN - (hb_min (hb_max (hb_forward (x), hb_forward (min)), hb_forward (max))) + (hb_min (hb_max (std::forward (x), std::forward (min)), std::forward (max))) } HB_FUNCOBJ (hb_clamp); +struct +{ + template void + operator () (T& a, T& b) const + { + using std::swap; // allow ADL + swap (a, b); + } +} +HB_FUNCOBJ (hb_swap); /* * Bithacks. @@ -795,7 +808,7 @@ hb_ceil_to_4 (unsigned int v) template static inline bool hb_in_range (T u, T lo, T hi) { - static_assert (!hb_is_signed::value, ""); + static_assert (!std::is_signed::value, ""); /* The casts below are important as if T is smaller than int, * the subtract results will become a signed int! */ -- cgit v1.2.3