summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-04-30 11:36:01 +0200
committerTor Egge <Tor.Egge@online.no>2021-04-30 11:36:01 +0200
commitdbde2a1234e3630c109c08ba1e50fe082afd2c1b (patch)
tree0bf1f319b6d966506955b4c47068e407df156765 /document
parente846ec3ccb131b020b7752abf6ee7c74b97f1533 (diff)
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