2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/HashingWriteBuffer.h>
|
|
|
|
#include <IO/WriteBufferFromFile.h>
|
2014-06-06 13:50:09 +00:00
|
|
|
|
2020-03-08 21:29:00 +00:00
|
|
|
#define FAIL(msg) do { std::cout << msg; exit(1); } while (false)
|
2014-06-06 13:50:09 +00:00
|
|
|
|
|
|
|
|
2019-12-15 06:34:43 +00:00
|
|
|
static CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len)
|
2014-06-06 13:50:09 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
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);
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t pos;
|
2014-06-06 13:50:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
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);
|
2014-06-06 13:50:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (pos < len)
|
2017-06-21 08:35:38 +00:00
|
|
|
state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, len - pos, state);
|
2014-06-06 13:50:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
return state;
|
2014-06-06 13:50:09 +00:00
|
|
|
}
|