mdbx: refine handling the MDBX_WITHOUT_MSVC_CRT option.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev)
2025-10-22 23:28:48 +03:00
parent 7e43e14c7b
commit 1cf65cd880
2 changed files with 3 additions and 3 deletions

View File

@@ -124,7 +124,7 @@ uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer) {
const uint64_t exponent = (uint64_t)IEEE754_DOUBLE_EXPONENTA_BIAS + IEEE754_DOUBLE_MANTISSA_SIZE - shift; const uint64_t exponent = (uint64_t)IEEE754_DOUBLE_EXPONENTA_BIAS + IEEE754_DOUBLE_MANTISSA_SIZE - shift;
assert(exponent > 0 && exponent <= IEEE754_DOUBLE_EXPONENTA_MAX); assert(exponent > 0 && exponent <= IEEE754_DOUBLE_EXPONENTA_MAX);
const uint64_t key = bias + (exponent << IEEE754_DOUBLE_MANTISSA_SIZE) + (mantissa - IEEE754_DOUBLE_IMPLICIT_LEAD); const uint64_t key = bias + (exponent << IEEE754_DOUBLE_MANTISSA_SIZE) + (mantissa - IEEE754_DOUBLE_IMPLICIT_LEAD);
#if !defined(_MSC_VER) || defined(_DEBUG) /* Workaround for MSVC error LNK2019: unresolved external \ #if !defined(_MSC_VER) || !MDBX_WITHOUT_MSVC_CRT /* Workaround for MSVC error LNK2019: unresolved external \
symbol __except1 referenced in function __ftol3_except */ symbol __except1 referenced in function __ftol3_except */
assert(key == mdbx_key_from_double((double)json_integer)); assert(key == mdbx_key_from_double((double)json_integer));
#endif /* Workaround for MSVC */ #endif /* Workaround for MSVC */
@@ -146,7 +146,7 @@ uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer) {
assert(exponent > 0 && exponent <= IEEE754_DOUBLE_EXPONENTA_MAX); assert(exponent > 0 && exponent <= IEEE754_DOUBLE_EXPONENTA_MAX);
const uint64_t key = const uint64_t key =
bias - 1 - (exponent << IEEE754_DOUBLE_MANTISSA_SIZE) - (mantissa - IEEE754_DOUBLE_IMPLICIT_LEAD); bias - 1 - (exponent << IEEE754_DOUBLE_MANTISSA_SIZE) - (mantissa - IEEE754_DOUBLE_IMPLICIT_LEAD);
#if !defined(_MSC_VER) || defined(_DEBUG) /* Workaround for MSVC error LNK2019: unresolved external \ #if !defined(_MSC_VER) || !MDBX_WITHOUT_MSVC_CRT /* Workaround for MSVC error LNK2019: unresolved external \
symbol __except1 referenced in function __ftol3_except */ symbol __except1 referenced in function __ftol3_except */
assert(key == mdbx_key_from_double((double)json_integer)); assert(key == mdbx_key_from_double((double)json_integer));
#endif /* Workaround for MSVC */ #endif /* Workaround for MSVC */

View File

@@ -189,7 +189,7 @@
/** Avoid dependence from MSVC CRT and use ntdll.dll instead. */ /** Avoid dependence from MSVC CRT and use ntdll.dll instead. */
#ifndef MDBX_WITHOUT_MSVC_CRT #ifndef MDBX_WITHOUT_MSVC_CRT
#if defined(MDBX_BUILD_CXX) && !MDBX_BUILD_CXX #if defined(MDBX_BUILD_CXX) && !MDBX_BUILD_CXX && (defined(_WIN32) || defined(_WIN64))
#define MDBX_WITHOUT_MSVC_CRT 1 #define MDBX_WITHOUT_MSVC_CRT 1
#else #else
#define MDBX_WITHOUT_MSVC_CRT 0 #define MDBX_WITHOUT_MSVC_CRT 0