mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
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:
parent
0d7391f8b2
commit
c95d46abbd
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user