From 242a28c320ae8b16144c5e91cbcf8806ce1e5d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 28 May 2019 08:07:45 +0300 Subject: [PATCH] MDEV-6812: Remove the wrapper my_log2f() --- storage/innobase/row/row0merge.cc | 17 +++-------------- 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 #include #include +#include #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 #include #include +#include #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));