mdbx++: явное приведение к int внутри constexpr mdbx::memcmp().

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-03-23 15:32:02 +03:00
parent d0799fd373
commit 80e9667ead

View File

@ -5120,8 +5120,8 @@ static MDBX_CXX20_CONSTEXPR int memcmp(const void *a, const void *b,
__cpp_lib_is_constant_evaluated >= 201811L __cpp_lib_is_constant_evaluated >= 201811L
if (::std::is_constant_evaluated()) { if (::std::is_constant_evaluated()) {
for (size_t i = 0; i < bytes; ++i) { for (size_t i = 0; i < bytes; ++i) {
const int diff = const int diff = int(static_cast<const byte *>(a)[i]) -
static_cast<const byte *>(a)[i] - static_cast<const byte *>(b)[i]; int(static_cast<const byte *>(b)[i]);
if (diff) if (diff)
return diff; return diff;
} }