mdbx: add MDBX_WORDBITS, update MAX_PAGENO.

Change-Id: Ibb0425cee9fd2870298e25f82ab094e57ac63f96
This commit is contained in:
Leonid Yuriev 2018-08-25 18:17:50 +03:00 committed by Leo Yuriev
parent 93a71c29e7
commit 25fc9305dd

View File

@ -120,6 +120,12 @@
/* *INDENT-ON* */
/* clang-format on */
#if UINTPTR_MAX > 0xffffFFFFul || ULONG_MAX > 0xffffFFFFul
#define MDBX_WORDBITS 64
#else
#define MDBX_WORDBITS 32
#endif /* MDBX_WORDBITS */
/*----------------------------------------------------------------------------*/
/* Basic constants and types */
@ -163,7 +169,7 @@
* size up to 2^44 bytes, in case of 4K pages. */
typedef uint32_t pgno_t;
#define PRIaPGNO PRIu32
#define MAX_PAGENO ((pgno_t)UINT64_C(0xffffFFFFffff))
#define MAX_PAGENO UINT32_C(0x7FFFffff)
#define MIN_PAGENO NUM_METAS
/* A transaction ID. */
@ -392,11 +398,13 @@ typedef struct MDBX_page {
#else
#define MAX_MAPSIZE32 UINT32_C(0x7ff80000)
#endif
#define MAX_MAPSIZE64 \
((sizeof(pgno_t) > 4) ? UINT64_C(0x7fffFFFFfff80000) \
: MAX_PAGENO * (uint64_t)MAX_PAGESIZE)
#define MAX_MAPSIZE64 (MAX_PAGENO * (uint64_t)MAX_PAGESIZE)
#define MAX_MAPSIZE ((sizeof(size_t) < 8) ? MAX_MAPSIZE32 : MAX_MAPSIZE64)
#if MDBX_WORDBITS >= 64
#define MAX_MAPSIZE MAX_MAPSIZE64
#else
#define MAX_MAPSIZE MAX_MAPSIZE32
#endif /* MDBX_WORDBITS */
/* The header for the reader table (a memory-mapped lock file). */
typedef struct MDBX_lockinfo {