mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Add cppcoreguidelines-avoid-magic-numbers exclusion to clang-tidy Remove existing nolint warnings using following script: ``` for file in `git ls-files | grep -v \.py`; do gsed '/^ *\/\/ NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)/d' -i $file; done ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/57841 Reviewed By: samestep Differential Revision: D28295045 Pulled By: malfet fbshipit-source-id: 7c6e8d1213c9593f169ed3df6a916498f1a97163
18 lines
526 B
C++
18 lines
526 B
C++
#include <c10/util/ConstexprCrc.h>
|
|
|
|
using c10::util::crc64;
|
|
using c10::util::crc64_t;
|
|
|
|
// generic tests
|
|
static_assert(
|
|
crc64("MyTestString") == crc64("MyTestString"),
|
|
"crc64 is deterministic");
|
|
static_assert(
|
|
crc64("MyTestString1") != crc64("MyTestString2"),
|
|
"different strings, different result");
|
|
|
|
// check concrete expected values (for CRC64 with Jones coefficients and an init
|
|
// value of 0)
|
|
static_assert(crc64_t{0} == crc64(""), "");
|
|
static_assert(crc64_t{0xe9c6d914c4b8d9ca} == crc64("123456789"), "");
|