Commit 251239af authored by Jan Lindström's avatar Jan Lindström

Fix Windows compiler error 'log2f': identifier not found

parent f13cf621
...@@ -39,6 +39,13 @@ Completed by Sunny Bains and Marko Makela ...@@ -39,6 +39,13 @@ Completed by Sunny Bains and Marko Makela
#include "row0import.h" #include "row0import.h"
#include "handler0alter.h" #include "handler0alter.h"
#include "ha_prototypes.h" #include "ha_prototypes.h"
#include "math.h" /* log() */
float my_log2f(float n)
{
/* log(n) / log(2) is log2. */
return (float)(log((double)n) / log((double)2));
}
/* Ignore posix_fadvise() on those platforms where it does not exist */ /* Ignore posix_fadvise() on those platforms where it does not exist */
#if defined __WIN__ #if defined __WIN__
...@@ -2222,7 +2229,7 @@ row_merge_sort( ...@@ -2222,7 +2229,7 @@ row_merge_sort(
/* Find the number N which 2^N is greater or equal than num_runs */ /* Find the number N which 2^N is greater or equal than num_runs */
/* N is merge sort running count */ /* N is merge sort running count */
total_merge_sort_count = ceil(log2f(num_runs)); total_merge_sort_count = ceil(my_log2f(num_runs));
if(total_merge_sort_count <= 0) { if(total_merge_sort_count <= 0) {
total_merge_sort_count=1; total_merge_sort_count=1;
} }
......
...@@ -39,6 +39,13 @@ Completed by Sunny Bains and Marko Makela ...@@ -39,6 +39,13 @@ Completed by Sunny Bains and Marko Makela
#include "row0import.h" #include "row0import.h"
#include "handler0alter.h" #include "handler0alter.h"
#include "ha_prototypes.h" #include "ha_prototypes.h"
#include "math.h" /* log2() */
float my_log2f(float n)
{
/* log(n) / log(2) is log2. */
return (float)(log((double)n) / log((double)2));
}
/* Ignore posix_fadvise() on those platforms where it does not exist */ /* Ignore posix_fadvise() on those platforms where it does not exist */
#if defined __WIN__ #if defined __WIN__
...@@ -2228,7 +2235,7 @@ row_merge_sort( ...@@ -2228,7 +2235,7 @@ row_merge_sort(
/* Find the number N which 2^N is greater or equal than num_runs */ /* Find the number N which 2^N is greater or equal than num_runs */
/* N is merge sort running count */ /* N is merge sort running count */
total_merge_sort_count = ceil(log2f(num_runs)); total_merge_sort_count = ceil(my_log2f(num_runs));
if(total_merge_sort_count <= 0) { if(total_merge_sort_count <= 0) {
total_merge_sort_count=1; total_merge_sort_count=1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment