diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-28 08:07:45 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-28 10:54:30 +0300 |
commit | 242a28c320ae8b16144c5e91cbcf8806ce1e5d68 (patch) | |
tree | 337f6ef8d23b4097f2312f329cc964b7a2855f65 | |
parent | 661289f4627b81b85d362cf62587dcfd4fb381c2 (diff) | |
download | mariadb-git-242a28c320ae8b16144c5e91cbcf8806ce1e5d68.tar.gz |
MDEV-6812: Remove the wrapper my_log2f()
-rw-r--r-- | storage/innobase/row/row0merge.cc | 17 | ||||
-rw-r--r-- | storage/xtradb/row/row0merge.cc | 17 |
2 files changed, 6 insertions, 28 deletions
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 5042a9ed170..463be8d229d 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -27,6 +27,7 @@ Completed by Sunny Bains and Marko Makela #include <my_config.h> #include <log.h> #include <sql_class.h> +#include <math.h> #include "row0merge.h" #include "row0ext.h" @@ -42,15 +43,8 @@ Completed by Sunny Bains and Marko Makela #include "row0import.h" #include "handler0alter.h" #include "ha_prototypes.h" -#include "math.h" /* log() */ #include "fil0crypt.h" -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 */ #if defined __WIN__ # define posix_fadvise(fd, offset, len, advice) /* nothing */ @@ -2503,18 +2497,13 @@ row_merge_sort( /* Record the number of merge runs we need to perform */ num_runs = file->offset; - /* Find the number N which 2^N is greater or equal than num_runs */ - /* N is merge sort running count */ - total_merge_sort_count = ceil(my_log2f(num_runs)); - if(total_merge_sort_count <= 0) { - total_merge_sort_count=1; - } - /* If num_runs are less than 1, nothing to merge */ if (num_runs <= 1) { DBUG_RETURN(error); } + total_merge_sort_count = ceil(log2f(num_runs)); + /* "run_offset" records each run's first offset number */ run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint)); diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index cc7c648fe4c..f71a623da20 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -27,6 +27,7 @@ Completed by Sunny Bains and Marko Makela #include <my_config.h> #include <log.h> #include <sql_class.h> +#include <math.h> #include "row0merge.h" #include "row0ext.h" @@ -42,15 +43,8 @@ Completed by Sunny Bains and Marko Makela #include "row0import.h" #include "handler0alter.h" #include "ha_prototypes.h" -#include "math.h" /* log2() */ #include "fil0crypt.h" -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 */ #if defined __WIN__ # define posix_fadvise(fd, offset, len, advice) /* nothing */ @@ -2516,18 +2510,13 @@ row_merge_sort( /* Record the number of merge runs we need to perform */ num_runs = file->offset; - /* Find the number N which 2^N is greater or equal than num_runs */ - /* N is merge sort running count */ - total_merge_sort_count = ceil(my_log2f(num_runs)); - if(total_merge_sort_count <= 0) { - total_merge_sort_count=1; - } - /* If num_runs are less than 1, nothing to merge */ if (num_runs <= 1) { DBUG_RETURN(error); } + total_merge_sort_count = ceil(log2f(num_runs)); + /* "run_offset" records each run's first offset number */ run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint)); |