Make round() fallback portable to systems that do have round()

Makes compiling without HAVE_ROUND on systems that do have it work.
This commit is contained in:
Behdad Esfahbod 2018-06-26 18:00:58 -04:00
parent 7db2e9ea38
commit 01dff1ea1a

View File

@ -1228,13 +1228,14 @@ struct hb_bytes_t
/* fallback for round() */
#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
static inline double
round (double x)
_hb_round (double x)
{
if (x >= 0)
return floor (x + 0.5);
else
return ceil (x - 0.5);
}
#define round(x) _hb_round(x)
#endif