From 50e0273ab18acd2fbb21bcf18ad487092e890b4e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 1 Dec 2018 13:03:52 -0500 Subject: [PATCH] Change hb_assert_unsigned_t<> to hb_is_signed<> --- src/hb-dsalgs.hh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 9c920fc..dccca3c 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -287,11 +287,15 @@ hb_ceil_to_4 (unsigned int v) return ((v - 1) | 3) + 1; } -template class hb_assert_unsigned_t; -template <> class hb_assert_unsigned_t {}; -template <> class hb_assert_unsigned_t {}; -template <> class hb_assert_unsigned_t {}; -template <> class hb_assert_unsigned_t {}; +template struct hb_is_signed; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = false }; }; template static inline bool hb_in_range (T u, T lo, T hi) @@ -301,7 +305,7 @@ hb_in_range (T u, T lo, T hi) * one right now. Declaring a variable won't work as HB_UNUSED * is unusable on some platforms and unused types are less likely * to generate a warning than unused variables. */ - static_assert ((sizeof (hb_assert_unsigned_t) >= 0), ""); + static_assert (!hb_is_signed::value, ""); /* The casts below are important as if T is smaller than int, * the subtract results will become a signed int! */ -- 2.7.4