Fix windows build: provide log2 function if the system doesn't have it.

This commit is contained in:
Sergey Petrunya 2010-06-26 23:55:33 +04:00
commit 7d9dc97682
2 changed files with 14 additions and 0 deletions

View file

@ -852,6 +852,7 @@ AC_CHECK_HEADERS([xfs/xfs.h])
#--------------------------------------------------------------------
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
AC_CHECK_FUNCS(log2)
AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
AC_CHECK_LIB(nsl, gethostbyname_r))

View file

@ -2567,6 +2567,19 @@ inline bool is_user_table(TABLE * table)
return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
}
#ifndef HAVE_LOG2
/*
This will be slightly slower and perhaps a tiny bit less accurate than
doing it the IEEE754 way but log2() should be available on C99 systems.
*/
inline double log2(double x)
{
return (log(x) / M_LN2);
}
#endif
/*
Some functions that are different in the embedded library and the normal
server