mdbx: fix MAX_MAPSIZE for Win32.

Change-Id: I04cbffb14ab7c73d935614b2f5c8140000b78d76
This commit is contained in:
Leo Yuriev 2017-06-21 01:20:21 +03:00
parent edc936dc28
commit f93818a926

View File

@ -345,11 +345,16 @@ typedef struct MDBX_page {
#define MIN_PAGESIZE 512u #define MIN_PAGESIZE 512u
#define MIN_MAPSIZE (MIN_PAGESIZE * MIN_PAGENO) #define MIN_MAPSIZE (MIN_PAGESIZE * MIN_PAGENO)
#define MAX_MAPSIZE \ #if defined(_WIN32) || defined(_WIN64)
((sizeof(size_t) < 8) \ #define MAX_MAPSIZE32 UINT32_C(0x38000000)
? UINT32_C(0x7ff80000) \ #else
: ((sizeof(pgno_t) > 4) ? UINT64_C(0x7fffFFFFfff80000) \ #define MAX_MAPSIZE32 UINT32_C(0x7ff80000)
: MAX_PAGENO * (uint64_t)MAX_PAGESIZE)) #endif
#define MAX_MAPSIZE64 \
((sizeof(pgno_t) > 4) ? UINT64_C(0x7fffFFFFfff80000) \
: MAX_PAGENO * (uint64_t)MAX_PAGESIZE)
#define MAX_MAPSIZE ((sizeof(size_t) < 8) ? MAX_MAPSIZE32 : MAX_MAPSIZE64)
#pragma pack(pop) #pragma pack(pop)