Skip to content

Commit 242a28c

Browse files
committed
MDEV-6812: Remove the wrapper my_log2f()
1 parent 661289f commit 242a28c

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

storage/innobase/row/row0merge.cc

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Completed by Sunny Bains and Marko Makela
2727
#include <my_config.h>
2828
#include <log.h>
2929
#include <sql_class.h>
30+
#include <math.h>
3031

3132
#include "row0merge.h"
3233
#include "row0ext.h"
@@ -42,15 +43,8 @@ Completed by Sunny Bains and Marko Makela
4243
#include "row0import.h"
4344
#include "handler0alter.h"
4445
#include "ha_prototypes.h"
45-
#include "math.h" /* log() */
4646
#include "fil0crypt.h"
4747

48-
float my_log2f(float n)
49-
{
50-
/* log(n) / log(2) is log2. */
51-
return (float)(log((double)n) / log((double)2));
52-
}
53-
5448
/* Ignore posix_fadvise() on those platforms where it does not exist */
5549
#if defined __WIN__
5650
# define posix_fadvise(fd, offset, len, advice) /* nothing */
@@ -2503,18 +2497,13 @@ row_merge_sort(
25032497
/* Record the number of merge runs we need to perform */
25042498
num_runs = file->offset;
25052499

2506-
/* Find the number N which 2^N is greater or equal than num_runs */
2507-
/* N is merge sort running count */
2508-
total_merge_sort_count = ceil(my_log2f(num_runs));
2509-
if(total_merge_sort_count <= 0) {
2510-
total_merge_sort_count=1;
2511-
}
2512-
25132500
/* If num_runs are less than 1, nothing to merge */
25142501
if (num_runs <= 1) {
25152502
DBUG_RETURN(error);
25162503
}
25172504

2505+
total_merge_sort_count = ceil(log2f(num_runs));
2506+
25182507
/* "run_offset" records each run's first offset number */
25192508
run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));
25202509

storage/xtradb/row/row0merge.cc

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Completed by Sunny Bains and Marko Makela
2727
#include <my_config.h>
2828
#include <log.h>
2929
#include <sql_class.h>
30+
#include <math.h>
3031

3132
#include "row0merge.h"
3233
#include "row0ext.h"
@@ -42,15 +43,8 @@ Completed by Sunny Bains and Marko Makela
4243
#include "row0import.h"
4344
#include "handler0alter.h"
4445
#include "ha_prototypes.h"
45-
#include "math.h" /* log2() */
4646
#include "fil0crypt.h"
4747

48-
float my_log2f(float n)
49-
{
50-
/* log(n) / log(2) is log2. */
51-
return (float)(log((double)n) / log((double)2));
52-
}
53-
5448
/* Ignore posix_fadvise() on those platforms where it does not exist */
5549
#if defined __WIN__
5650
# define posix_fadvise(fd, offset, len, advice) /* nothing */
@@ -2516,18 +2510,13 @@ row_merge_sort(
25162510
/* Record the number of merge runs we need to perform */
25172511
num_runs = file->offset;
25182512

2519-
/* Find the number N which 2^N is greater or equal than num_runs */
2520-
/* N is merge sort running count */
2521-
total_merge_sort_count = ceil(my_log2f(num_runs));
2522-
if(total_merge_sort_count <= 0) {
2523-
total_merge_sort_count=1;
2524-
}
2525-
25262513
/* If num_runs are less than 1, nothing to merge */
25272514
if (num_runs <= 1) {
25282515
DBUG_RETURN(error);
25292516
}
25302517

2518+
total_merge_sort_count = ceil(log2f(num_runs));
2519+
25312520
/* "run_offset" records each run's first offset number */
25322521
run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));
25332522

0 commit comments

Comments
 (0)