Fallback if roundf didn't exist, like in dietlibc (#1953)
This commit is contained in:
parent
d3b984d379
commit
d50d2fcbc7
|
@ -108,7 +108,7 @@ endmacro ()
|
|||
if (UNIX)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES m)
|
||||
endif ()
|
||||
check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
|
||||
check_funcs(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l roundf)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
if (${HAVE_UNISTD_H})
|
||||
add_definitions(-DHAVE_UNISTD_H)
|
||||
|
|
|
@ -477,6 +477,15 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
|
|||
/* Size signifying variable-sized array */
|
||||
#define VAR 1
|
||||
|
||||
static inline double
|
||||
_hb_roundf (float x)
|
||||
{
|
||||
return x >= 0 ? floor ((double) x + .5) : ceil ((double) x - .5);
|
||||
}
|
||||
#ifndef HAVE_ROUNDF
|
||||
#define roundf(x) _hb_roundf(x)
|
||||
#endif
|
||||
|
||||
/* Endian swap, used in Windows related backends */
|
||||
static inline uint16_t hb_uint16_swap (const uint16_t v)
|
||||
{ return (v >> 8) | (v << 8); }
|
||||
|
|
Loading…
Reference in New Issue