WeakHash.h 737 字节
Newer Older
N
Nikolai Kochetov 已提交
1 2 3 4 5 6
#pragma once
#include <Common/PODArray.h>

namespace DB
{

A
alexey-milovidov 已提交
7 8
/// It's a class which represents the result of weak and fast hash function per row in column.
/// It's usually hardware accelerated CRC32-C.
N
Nikolai Kochetov 已提交
9 10 11 12 13 14 15 16 17
/// Has function result may be combined to calculate hash for tuples.
///
/// The main purpose why this class needed is to support data initialization. Initially, every bit is 1.
class WeakHash32
{
public:
    using Container = PaddedPODArray<UInt32>;

    explicit WeakHash32(size_t size) : data(size, ~UInt32(0)) {}
18
    WeakHash32(const WeakHash32 & other) { data.assign(other.data); }
N
Nikolai Kochetov 已提交
19 20 21 22 23 24 25 26 27

    const Container & getData() const { return data; }
    Container & getData() { return data; }

private:
    PaddedPODArray<UInt32> data;
};

}