mdbx: обмен порядка атрибутов pure|const/maybe_unused в определении функций.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-11-10 21:17:34 +03:00
parent 7aa5d9ab97
commit 871bb7f56c
4 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@
#include "essentials.h" #include "essentials.h"
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION MDBX_INTERNAL size_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED MDBX_INTERNAL size_t
dbi_bitmap_ctz_fallback(const MDBX_txn *txn, intptr_t bmi); dbi_bitmap_ctz_fallback(const MDBX_txn *txn, intptr_t bmi);
#if MDBX_ENABLE_DBI_SPARSE #if MDBX_ENABLE_DBI_SPARSE

View File

@ -115,20 +115,20 @@ extern LIBMDBX_API const char *const mdbx_sourcery_anchor;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline pgno_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline pgno_t
int64pgno(int64_t i64) { int64pgno(int64_t i64) {
if (likely(i64 >= (int64_t)MIN_PAGENO && i64 <= (int64_t)MAX_PAGENO + 1)) if (likely(i64 >= (int64_t)MIN_PAGENO && i64 <= (int64_t)MAX_PAGENO + 1))
return (pgno_t)i64; return (pgno_t)i64;
return (i64 < (int64_t)MIN_PAGENO) ? MIN_PAGENO : MAX_PAGENO; return (i64 < (int64_t)MIN_PAGENO) ? MIN_PAGENO : MAX_PAGENO;
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline pgno_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline pgno_t
pgno_add(size_t base, size_t augend) { pgno_add(size_t base, size_t augend) {
assert(base <= MAX_PAGENO + 1 && augend < MAX_PAGENO); assert(base <= MAX_PAGENO + 1 && augend < MAX_PAGENO);
return int64pgno((int64_t)base + (int64_t)augend); return int64pgno((int64_t)base + (int64_t)augend);
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline pgno_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline pgno_t
pgno_sub(size_t base, size_t subtrahend) { pgno_sub(size_t base, size_t subtrahend) {
assert(base >= MIN_PAGENO && base <= MAX_PAGENO + 1 && assert(base >= MIN_PAGENO && base <= MAX_PAGENO + 1 &&
subtrahend < MAX_PAGENO); subtrahend < MAX_PAGENO);

View File

@ -6,7 +6,7 @@
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Unaligned access */ * Unaligned access */
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline size_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline size_t
field_alignment(size_t alignment_baseline, size_t field_offset) { field_alignment(size_t alignment_baseline, size_t field_offset) {
size_t merge = alignment_baseline | (size_t)field_offset; size_t merge = alignment_baseline | (size_t)field_offset;
return merge & -(int)merge; return merge & -(int)merge;

View File

@ -41,7 +41,7 @@
ASAN_UNPOISON_MEMORY_REGION(addr, size); \ ASAN_UNPOISON_MEMORY_REGION(addr, size); \
} while (0) } while (0)
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline size_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline size_t
branchless_abs(intptr_t value) { branchless_abs(intptr_t value) {
assert(value > INT_MIN); assert(value > INT_MIN);
const size_t expanded_sign = const size_t expanded_sign =
@ -49,23 +49,23 @@ branchless_abs(intptr_t value) {
return ((size_t)value + expanded_sign) ^ expanded_sign; return ((size_t)value + expanded_sign) ^ expanded_sign;
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline bool MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline bool
is_powerof2(size_t x) { is_powerof2(size_t x) {
return (x & (x - 1)) == 0; return (x & (x - 1)) == 0;
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline size_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline size_t
floor_powerof2(size_t value, size_t granularity) { floor_powerof2(size_t value, size_t granularity) {
assert(is_powerof2(granularity)); assert(is_powerof2(granularity));
return value & ~(granularity - 1); return value & ~(granularity - 1);
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION static inline size_t MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED static inline size_t
ceil_powerof2(size_t value, size_t granularity) { ceil_powerof2(size_t value, size_t granularity) {
return floor_powerof2(value + granularity - 1, granularity); return floor_powerof2(value + granularity - 1, granularity);
} }
MDBX_MAYBE_UNUSED MDBX_NOTHROW_CONST_FUNCTION MDBX_INTERNAL unsigned MDBX_NOTHROW_CONST_FUNCTION MDBX_MAYBE_UNUSED MDBX_INTERNAL unsigned
log2n_powerof2(size_t value_uintptr); log2n_powerof2(size_t value_uintptr);
MDBX_NOTHROW_CONST_FUNCTION MDBX_INTERNAL uint64_t rrxmrrxmsx_0(uint64_t v); MDBX_NOTHROW_CONST_FUNCTION MDBX_INTERNAL uint64_t rrxmrrxmsx_0(uint64_t v);