Fallback if roundf didn't exist, like in dietlibc (#1953)

pull/1956/head
Ebrahim Byagowi 6 years ago committed by Behdad Esfahbod
parent d3b984d379
commit d50d2fcbc7
  1. 2
      CMakeLists.txt
  2. 9
      src/hb.hh

@ -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…
Cancel
Save