ClickHouse/dbms/IO/tests/hashing_buffer.h

21 lines
613 B
C++
Raw Normal View History

#include <IO/HashingWriteBuffer.h>
#include <IO/WriteBufferFromFile.h>
2020-03-08 21:29:00 +00:00
#define FAIL(msg) do { std::cout << msg; exit(1); } while (false)
2019-12-15 06:34:43 +00:00
static CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len)
{
const size_t block_size = DBMS_DEFAULT_HASHING_BLOCK_SIZE;
2017-06-21 08:35:38 +00:00
CityHash_v1_0_2::uint128 state(0, 0);
size_t pos;
for (pos = 0; pos + block_size <= len; pos += block_size)
2017-06-21 08:35:38 +00:00
state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, block_size, state);
if (pos < len)
2017-06-21 08:35:38 +00:00
state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, len - pos, state);
return state;
}