mdbx: check sys-pagesize for power-of-2.

This commit is contained in:
Leo Yuriev
2017-04-05 18:33:19 +03:00
parent b558757cf1
commit 095cd25e23
2 changed files with 9 additions and 7 deletions

View File

@@ -780,3 +780,10 @@ void mdbx_rthc_unlock(void);
int mdbx_rthc_alloc(mdbx_thread_key_t *key, MDB_reader *begin, MDB_reader *end);
void mdbx_rthc_remove(mdbx_thread_key_t key);
void mdbx_rthc_cleanup(void);
static __inline bool is_power2(size_t x) { return (x & (x - 1)) == 0; }
static __inline size_t roundup2(size_t value, size_t granularity) {
assert(is_power2(granularity));
return (value + granularity - 1) & ~(granularity - 1);
}