X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FChecksum.cpp;h=a7afa352b8a789eac91c23725b9983032f89c67e;hb=fa33147273be70b6c796fc83c086897ac06d6a40;hp=788e0a19ade4249c889e0b737435e6816249d830;hpb=19e5f7ed316251e9c559c42322b97f9a5e9f47d8;p=folly.git diff --git a/folly/Checksum.cpp b/folly/Checksum.cpp index 788e0a19..a7afa352 100644 --- a/folly/Checksum.cpp +++ b/folly/Checksum.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2015 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,17 +14,25 @@ * limitations under the License. */ -#include "folly/Checksum.h" +#include #include #include #include -#include "folly/CpuId.h" +#include namespace folly { namespace detail { -#if defined(__x86_64__) && defined (__GNUC__) +#ifndef __has_builtin + /* nolint */ + #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,