mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:34:13 +08:00
mdbx: rename log2n_powerof2()
.
Change-Id: I22290630186c5041b6ae242d0db1f5c5f36da4ec
This commit is contained in:
parent
d1fea74d0e
commit
55f41f40a1
@ -417,7 +417,7 @@ static __inline size_t valsize_max(size_t pagesize, MDBX_db_flags_t flags) {
|
||||
if (flags & (MDBX_DUPSORT | MDBX_DUPFIXED | MDBX_REVERSEDUP))
|
||||
return keysize_max(pagesize, 0);
|
||||
|
||||
const unsigned page_ln2 = log2n(pagesize);
|
||||
const unsigned page_ln2 = log2n_powerof2(pagesize);
|
||||
const size_t hard = 0x7FF00000ul;
|
||||
const size_t hard_pages = hard >> page_ln2;
|
||||
STATIC_ASSERT(MDBX_PGL_LIMIT <= MAX_PAGENO);
|
||||
@ -10472,7 +10472,7 @@ static void __cold mdbx_setup_pagesize(MDBX_env *env, const size_t pagesize) {
|
||||
leaf_nodemax >= branch_nodemax &&
|
||||
leaf_nodemax < (int)UINT16_MAX && leaf_nodemax % 2 == 0);
|
||||
env->me_leaf_nodemax = (unsigned)leaf_nodemax;
|
||||
env->me_psize2log = (uint8_t)log2n(pagesize);
|
||||
env->me_psize2log = (uint8_t)log2n_powerof2(pagesize);
|
||||
mdbx_assert(env, pgno2bytes(env, 1) == pagesize);
|
||||
mdbx_assert(env, bytes2pgno(env, pagesize + pagesize) == 2);
|
||||
|
||||
@ -11646,7 +11646,7 @@ __cold int mdbx_is_readahead_reasonable(size_t volume, intptr_t redundancy) {
|
||||
if (unlikely(err != MDBX_SUCCESS))
|
||||
return err;
|
||||
|
||||
const int log2page = log2n(pagesize);
|
||||
const int log2page = log2n_powerof2(pagesize);
|
||||
const intptr_t volume_pages = (volume + pagesize - 1) >> log2page;
|
||||
const intptr_t redundancy_pages =
|
||||
(redundancy < 0) ? -(intptr_t)((-redundancy + pagesize - 1) >> log2page)
|
||||
|
@ -1568,7 +1568,8 @@ ceil_powerof2(size_t value, size_t granularity) {
|
||||
return floor_powerof2(value + granularity - 1, granularity);
|
||||
}
|
||||
|
||||
MDBX_NOTHROW_CONST_FUNCTION static __maybe_unused unsigned log2n(size_t value) {
|
||||
MDBX_NOTHROW_CONST_FUNCTION static __maybe_unused unsigned
|
||||
log2n_powerof2(size_t value) {
|
||||
assert(value > 0 && value < INT32_MAX && is_powerof2(value));
|
||||
assert((value & -(int32_t)value) == value);
|
||||
#if __GNUC_PREREQ(4, 1) || __has_builtin(__builtin_ctzl)
|
||||
|
@ -2409,7 +2409,7 @@ __cold int mdbx_get_sysraminfo(intptr_t *page_size, intptr_t *total_pages,
|
||||
if (unlikely(pagesize < MIN_PAGESIZE || !is_powerof2(pagesize)))
|
||||
return MDBX_INCOMPATIBLE;
|
||||
|
||||
__maybe_unused const int log2page = log2n(pagesize);
|
||||
__maybe_unused const int log2page = log2n_powerof2(pagesize);
|
||||
assert(pagesize == (INT64_C(1) << log2page));
|
||||
(void)log2page;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user