mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fixed error with non-SIMD implementation of memcmpSmall
This commit is contained in:
parent
d414e7366c
commit
6b2810d346
@ -5,13 +5,6 @@
|
||||
|
||||
#include <Core/Defines.h>
|
||||
|
||||
/// We can process uninitialized memory in the functions below.
|
||||
/// Results don't depend on the values inside uninitialized memory but Memory Sanitizer cannot see it.
|
||||
/// Disable optimized functions if compile with Memory Sanitizer.
|
||||
|
||||
#if defined(__SSE2__) && !defined(MEMORY_SANITIZER)
|
||||
#include <emmintrin.h>
|
||||
|
||||
|
||||
namespace detail
|
||||
{
|
||||
@ -28,6 +21,15 @@ inline int cmp(T a, T b)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// We can process uninitialized memory in the functions below.
|
||||
/// Results don't depend on the values inside uninitialized memory but Memory Sanitizer cannot see it.
|
||||
/// Disable optimized functions if compile with Memory Sanitizer.
|
||||
|
||||
#if defined(__SSE2__) && !defined(MEMORY_SANITIZER)
|
||||
#include <emmintrin.h>
|
||||
|
||||
|
||||
/** All functions works under the following assumptions:
|
||||
* - it's possible to read up to 15 excessive bytes after end of 'a' and 'b' region;
|
||||
* - memory regions are relatively small and extra loop unrolling is not worth to do.
|
||||
@ -198,7 +200,10 @@ inline bool memoryIsZeroSmallAllowOverflow15(const void * data, size_t size)
|
||||
template <typename Char>
|
||||
inline int memcmpSmallAllowOverflow15(const Char * a, size_t a_size, const Char * b, size_t b_size)
|
||||
{
|
||||
return memcmp(a, b, std::min(a_size, b_size));
|
||||
if (auto res = memcmp(a, b, std::min(a_size, b_size)))
|
||||
return res;
|
||||
else
|
||||
return detail::cmp(a_size, b_size);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
|
Loading…
Reference in New Issue
Block a user