16 #ifndef IMPALA_RUNTIME_STRING_VALUE_INLINE_H
17 #define IMPALA_RUNTIME_STRING_VALUE_INLINE_H
37 static inline int StringCompare(
const char* s1,
int n1,
const char* s2,
int n2,
int len) {
38 DCHECK_EQ(len, std::min(n1, n2));
41 __m128i xmm0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(s1));
42 __m128i xmm1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(s2));
46 return s1[chars_match] - s2[chars_match];
54 int result = strncmp(s1, s2, len);
55 if (result != 0)
return result;
60 int l = std::min(
len, other.
len);
64 }
else if (
len == 0) {
67 DCHECK_EQ(other.
len, 0);
75 if (this->
len != other.
len)
return false;
90 while (begin <
len &&
ptr[begin] ==
' ') {
93 int32_t end =
len - 1;
94 while (end > begin &&
ptr[end] ==
' ') {
101 DCHECK(cptr != NULL);
102 DCHECK_GE(cptr_len, 1);
103 DCHECK_GE(cptr_len, num_chars);
104 memset(&cptr[num_chars],
' ', cptr_len - num_chars);
108 DCHECK(cptr != NULL);
110 int64_t last = len - 1;
111 while (last >= 0 && cptr[last] ==
' ') --last;
117 if (slot == NULL)
return NULL;
120 DCHECK_EQ(sv->
len, type.
len);
123 return reinterpret_cast<char*
>(slot);
128 if (slot == NULL)
return NULL;
131 DCHECK_EQ(sv->
len, type.
len);
134 return reinterpret_cast<const char*
>(slot);
bool Eq(const StringValue &other) const
==
static SSE_ALWAYS_INLINE int SSE4_cmpestri(__m128i str1, int len1, __m128i str2, int len2, const int mode)
static void PadWithSpaces(char *cptr, int64_t cptr_len, int64_t num_chars)
StringValue Trim() const
Trims leading and trailing spaces.
static int64_t UnpaddedCharLength(const char *cptr, int64_t len)
Returns number of characters in a char array (ignores trailing spaces)
int Compare(const StringValue &other) const
int len
Only set if type == TYPE_CHAR or type == TYPE_VARCHAR.
static const int64_t SSE4_2
StringValue Substring(int start_pos) const
Returns the substring starting at start_pos until the end of string.
static char * CharSlotToPtr(void *slot, const ColumnType &type)
static const int STRCMP_MODE
static int StringCompare(const char *s1, int n1, const char *s2, int n2, int len)
static bool IsSupported(long flag)
Returns whether of not the cpu supports this flag.
static const int CHARS_PER_128_BIT_REGISTER