summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in1
-rw-r--r--sql/mysql_priv.h13
2 files changed, 14 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index b524dcee702..187d65684ea 100644
--- a/configure.in
+++ b/configure.in
@@ -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))
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d62ffd6adca..024d20472c3 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -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