summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-04-30 11:42:41 +0200
committerGitHub <noreply@github.com>2021-04-30 11:42:41 +0200
commitb08ecfadb9cd518d0a9ae3ca13eb6dc31e43fcdd (patch)
tree12c73bf7085cc0b9c8a4306618d4c5288d30fcfc /document
parent46fb642b9f5c75d835b15470621ed095c64d5455 (diff)
parentdbde2a1234e3630c109c08ba1e50fe082afd2c1b (diff)
Merge pull request #17675 from vespa-engine/toregge/avoid-sse2-built-in-functions-when-cpu-is-not-x86-64
Avoid SSE2 built-in functions when CPU arch is not x86_64
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/base/idstring.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp
index 6cdfec3c24a..4762c940939 100644
--- a/document/src/vespa/document/base/idstring.cpp
+++ b/document/src/vespa/document/base/idstring.cpp
@@ -7,6 +7,7 @@
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/optimized.h>
#include <cerrno>
+#include <cstring>
using vespalib::string;
using vespalib::stringref;
@@ -56,13 +57,16 @@ union FourByte {
const FourByte _G_null = {{'n', 'u', 'l', 'l'}};
const TwoByte _G_id = {{'i', 'd'}};
+#ifdef __x86_64__
typedef char v16qi __attribute__ ((__vector_size__(16)));
v16qi _G_zero = { ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':', ':' };
+#endif
inline const char *
fmemchr(const char * s, const char * e)
{
+#ifdef __x86_64__
while (s+15 < e) {
#ifdef __clang__
v16qi tmpCurrent = __builtin_ia32_lddqu(s);
@@ -101,6 +105,9 @@ fmemchr(const char * s, const char * e)
s++;
}
return nullptr;
+#else
+ return static_cast<const char *>(memchr(s, ':', e - s));
+#endif
}
void