From cba9893ac5470e5d70888ec240453b581a657252 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 29 Jun 2020 01:55:57 -0700 Subject: [PATCH] m[algs] Move roundf() here --- src/hb-algs.hh | 7 +++++++ src/hb.hh | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index b053923df..fc6ba15d5 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -150,6 +150,12 @@ struct BEInt private: uint8_t v[4]; }; +/* Floats. */ + +/* We want our rounding towards +infinity. */ +static inline float +_hb_roundf (float x) { return floorf (x + .5f); } +#define roundf(x) _hb_roundf(x) /* Encodes three unsigned integers in one 64-bit number. If the inputs have more than 21 bits, @@ -165,6 +171,7 @@ struct BEInt #define HB_CODEPOINT_DECODE3_11_7_14_2(v) ((hb_codepoint_t) (((v) >> 14) & 0x007Fu) | 0x0300) #define HB_CODEPOINT_DECODE3_11_7_14_3(v) ((hb_codepoint_t) (v) & 0x3FFFu) + struct { /* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */ diff --git a/src/hb.hh b/src/hb.hh index 5915e2819..0033215a4 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -448,11 +448,6 @@ static_assert ((sizeof (hb_mask_t) == 4), ""); static_assert ((sizeof (hb_var_int_t) == 4), ""); -static inline float -_hb_roundf (float x) { return floorf (x + .5f); } -#define roundf(x) _hb_roundf(x) - - /* * For lack of a better place, put Zawgyi script hack here. * https://github.com/harfbuzz/harfbuzz/issues/1162