#include "folly/Range.h"
+#if FOLLY_HAVE_EMMINTRIN_H
#include <emmintrin.h> // __v16qi
+#endif
#include <iostream>
namespace folly {
(reinterpret_cast<uintptr_t>(addr) / kMinPageSize)
-#if FOLLY_HAVE_EMMINTRIN_H
+// Earlier versions of GCC (for example, Clang on Mac OS X, which is based on
+// GCC 4.2) do not have a full compliment of SSE builtins.
+#if FOLLY_HAVE_EMMINTRIN_H && __GNUC_PREREQ(4, 6)
inline size_t nextAlignedIndex(const char* arr) {
auto firstPossible = reinterpret_cast<uintptr_t>(arr) + 1;
return 1 + // add 1 because the index starts at 'arr'
}
return StringPiece::npos;
}
-#endif // FOLLY_HAVE_EMMINTRIN_H
+#endif // FOLLY_HAVE_EMMINTRIN_H && GCC 4.6+
// Aho, Hopcroft, and Ullman refer to this trick in "The Design and Analysis
// of Computer Algorithms" (1974), but the best description is here:
return StringPiece::npos;
}
-#if FOLLY_HAVE_EMMINTRIN_H
+#if FOLLY_HAVE_EMMINTRIN_H && __GNUC_PREREQ(4, 6)
template <bool HAYSTACK_ALIGNED>
inline size_t scanHaystackBlock(const StringPiece& haystack,
return StringPiece::npos;
}
-#endif // FOLLY_HAVE_EMMINTRIN_H
+#endif // FOLLY_HAVE_EMMINTRIN_H && GCC 4.6+
size_t qfind_first_byte_of_nosse(const StringPiece& haystack,
const StringPiece& needles) {
size_t qfind_first_byte_of_nosse(const StringPiece& haystack,
const StringPiece& needles);
-#if FOLLY_HAVE_EMMINTRIN_H
+#if FOLLY_HAVE_EMMINTRIN_H && __GNUC_PREREQ(4, 6)
size_t qfind_first_byte_of_sse42(const StringPiece& haystack,
const StringPiece& needles);