unrevert "(wangle) express current Core functionality with a state machine""
[folly.git] / folly / Checksum.cpp
index 28ed83920247f6e5696a04a91061ee9761c5c3a1..881fc7d20ff1ff3aa483319c4d290e5fd585e153 100644 (file)
  * limitations under the License.
  */
 
-#include "folly/Checksum.h"
+#include <folly/Checksum.h>
 #include <algorithm>
 #include <stdexcept>
 #include <boost/crc.hpp>
-#include "folly/CpuId.h"
+#include <folly/CpuId.h>
 
 namespace folly {
 
 namespace detail {
 
-#if defined(__x86_64__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
-    (((__GNUC__ * 100) + __GNUC_MINOR__) >= 407)
+#ifndef __has_builtin
+  #define __has_builtin(x) 0
+#endif
+
+#if (__has_builtin(__builtin_ia32_crc32qi) && \
+     __has_builtin(__builtin_ia32_crc32di)) || \
+    (FOLLY_X64 && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
+     (((__GNUC__ * 100) + __GNUC_MINOR__) >= 407))
 
 // Fast SIMD implementation of CRC-32C for x86 with SSE 4.2
 uint32_t crc32c_hw(const uint8_t *data, size_t nbytes,