From 3a7f5bdd18314676425ec811199767a5f8e65a40 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 26 Apr 2019 14:40:01 -0700 Subject: [PATCH] Rewrite hb_is_signed() --- src/hb-meta.hh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/hb-meta.hh b/src/hb-meta.hh index 005420364..c3efe48a6 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -134,15 +134,17 @@ template struct hb_is_same : hb_true_t {}; #define hb_is_same(T, T2) hb_is_same::value template struct hb_is_signed; -/* https://github.com/harfbuzz/harfbuzz/issues/1535 */ -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 <> struct hb_is_signed { enum { value = CHAR_MIN < 0 }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; +template <> struct hb_is_signed { enum { value = true }; }; +template <> struct hb_is_signed { enum { value = false }; }; #define hb_is_signed(T) hb_is_signed::value template struct hb_int_min { static constexpr T value = 0; };