| 1 | #include <IO/HashingWriteBuffer.h> |
|---|---|
| 2 | #include <IO/WriteBufferFromFile.h> |
| 3 | |
| 4 | #define FAIL(msg) do { std::cout << msg; exit(1); } while (0) |
| 5 | |
| 6 | |
| 7 | static CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len) |
| 8 | { |
| 9 | const size_t block_size = DBMS_DEFAULT_HASHING_BLOCK_SIZE; |
| 10 | CityHash_v1_0_2::uint128 state(0, 0); |
| 11 | size_t pos; |
| 12 | |
| 13 | for (pos = 0; pos + block_size <= len; pos += block_size) |
| 14 | state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, block_size, state); |
| 15 | |
| 16 | if (pos < len) |
| 17 | state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, len - pos, state); |
| 18 | |
| 19 | return state; |
| 20 | } |
| 21 |