Remove C++11 compatibility from c10::util::crc64_t (#30920)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30920

deletecode
ghstack-source-id: 95255641

Test Plan: waitforsandcastle

Differential Revision: D18869640

fbshipit-source-id: c3d7f4e1a29caff9fd8a8141c258f6f1c3fd830c
This commit is contained in:
Sebastian Messmer 2019-12-15 23:40:48 -08:00 committed by Facebook Github Bot
parent 0d7391f8b2
commit c95d46abbd

View File

@ -100,23 +100,11 @@ constexpr uint64_t crc64_table[] = {
inline C10_HOST_CONSTEXPR uint64_t
crc64impl(uint64_t accumulator, const char* data, size_t size) {
#if __cpp_constexpr >= 201304
// if we are in C++14, just use a for loop. This compiles faster.
for (size_t i = 0; i < size; ++i) {
accumulator =
crc64_table[(accumulator ^ data[i]) & 0xFF] ^ (accumulator >> 8);
}
return accumulator;
#else
// if we are in C++11, we need to do it recursively because of constexpr
// restrictions.
return (size == 0)
? accumulator
: crc64impl(
crc64_table[(accumulator ^ *data) & 0xFF] ^ (accumulator >> 8),
data + 1,
size - 1);
#endif
}
} // namespace detail