From 955d79c6e07c1834e6381a8c00accb3f5319f8c3 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 28 Mar 2018 14:19:49 +0800 Subject: [PATCH] intarith: get rid of ROUND_UP* macros Signed-off-by: xie xingguo --- src/include/intarith.h | 12 ------------ src/os/bluestore/BlueStore.h | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/include/intarith.h b/src/include/intarith.h index e08cbc0e4f26c..242056e216f2e 100644 --- a/src/include/intarith.h +++ b/src/include/intarith.h @@ -17,29 +17,17 @@ #include -#ifndef DIV_ROUND_UP -#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -#endif - template constexpr inline std::make_unsigned_t> div_round_up(T n, U d) { return (n + d - 1) / d; } -#ifndef ROUND_UP_TO -#define ROUND_UP_TO(n, d) ((n)%(d) ? ((n)+(d)-(n)%(d)) : (n)) -#endif - template constexpr inline std::make_unsigned_t> round_up_to(T n, U d) { return (n % d ? (n + d - n % d) : n); } -#ifndef SHIFT_ROUND_UP -#define SHIFT_ROUND_UP(x,y) (((x)+(1<<(y))-1) >> (y)) -#endif - template constexpr inline std::make_unsigned_t> shift_round_up(T x, U y) { return (x + (1 << y) - 1) >> y; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index da993a8a908e2..d31d8220b12b0 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2707,13 +2707,13 @@ public: assert(min_alloc_size && isp2(min_alloc_size)); assert(mem_cap); - total = ROUND_UP_TO(total, min_alloc_size); + total = round_up_to(total, min_alloc_size); granularity = total * BLOOM_FILTER_TABLE_SIZE * 2 / mem_cap; if (!granularity) { granularity = min_alloc_size; } else { - granularity = ROUND_UP_TO(granularity, min_alloc_size); + granularity = round_up_to(granularity, min_alloc_size); } uint64_t entries = p2roundup(total, granularity) / granularity; -- 2.39.5