From: xie xingguo Date: Wed, 28 Mar 2018 06:19:49 +0000 (+0800) Subject: intarith: get rid of ROUND_UP* macros X-Git-Tag: v13.1.0~457^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=955d79c6e07c1834e6381a8c00accb3f5319f8c3;p=ceph.git intarith: get rid of ROUND_UP* macros Signed-off-by: xie xingguo --- diff --git a/src/include/intarith.h b/src/include/intarith.h index e08cbc0e4f26..242056e216f2 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 da993a8a908e..d31d8220b12b 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;