From 407a112e7b743e75053ed2278416cb1bd5c91fac Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Aug 2021 12:23:53 -0600 Subject: [PATCH] [meta] Make hb_is_signed/hb_is_unsigned work on all types They were failing if type was non-scalar, eg. pointer. --- src/hb-meta.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hb-meta.hh b/src/hb-meta.hh index c9cea1181..4f79c896f 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -259,15 +259,15 @@ using hb_is_arithmetic = hb_bool_constant< #define hb_is_arithmetic(T) hb_is_arithmetic::value -template -using hb_is_signed = hb_conditional, - hb_false_type>; +template struct hb_is_signed_; +template struct hb_is_signed_ : hb_false_type {}; +template struct hb_is_signed_ : hb_bool_constant<(T) -1 < (T) 0> {}; +template struct hb_is_signed : hb_is_signed_ {}; #define hb_is_signed(T) hb_is_signed::value -template -using hb_is_unsigned = hb_conditional, - hb_false_type>; +template struct hb_is_unsigned_; +template struct hb_is_unsigned_ : hb_false_type {}; +template struct hb_is_unsigned_ : hb_bool_constant<(T) 0 < (T) -1> {}; +template struct hb_is_unsigned : hb_is_unsigned_ {}; #define hb_is_unsigned(T) hb_is_unsigned::value template struct hb_int_min;