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:
parent
7db2e9ea38
commit
01dff1ea1a
@ -1228,13 +1228,14 @@ struct hb_bytes_t
|
|||||||
/* fallback for round() */
|
/* fallback for round() */
|
||||||
#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
|
#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
|
||||||
static inline double
|
static inline double
|
||||||
round (double x)
|
_hb_round (double x)
|
||||||
{
|
{
|
||||||
if (x >= 0)
|
if (x >= 0)
|
||||||
return floor (x + 0.5);
|
return floor (x + 0.5);
|
||||||
else
|
else
|
||||||
return ceil (x - 0.5);
|
return ceil (x - 0.5);
|
||||||
}
|
}
|
||||||
|
#define round(x) _hb_round(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user