mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 16:31:14 +01:00
hb-private.hh: Add fallback implementation for round()
For pre-C99 compilers that do not support round(), we need to have a
simplistic implementation for it, when it is not detected during build
configuration, either via CMake or autotools, by using floor() and
ceil(), which are provided in the pre-C99 compilers.
Please see discussion at commit 86a0ac2 for more details for re-adding
this patch.
This commit is contained in:
1 parent
95f0458f44
commit
19256bef9d
1 file changed
+13
@@ -1070,4 +1070,17 @@ struct hb_string_t
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* fallback for round() */
|
||||||
|
#if !defined (HAVE_ROUND) && !defined (HAVE_DECL_ROUND)
|
||||||
|
static inline double
|
||||||
|
round (double x)
|
||||||
|
{
|
||||||
|
if (x >= 0)
|
||||||
|
return floor (x + 0.5);
|
||||||
|
else
|
||||||
|
return ceil (x - 0.5);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* HB_PRIVATE_HH */
|
#endif /* HB_PRIVATE_HH */
|
||||||
Reference in new issue
Block a user