Buckets:

soixantesept's picture
download
raw
986 Bytes
#pragma once
#include "Array.hpp"
#include "Bucket16.hpp"
#include "Hash.hpp"
#include <cassert>
#include <cstdint>
template<typename T>
class LargeIndirectContext {
private:
Array<Bucket16<T, 7>> data;
const uint32_t hashBits, inputBits;
public:
LargeIndirectContext(const int hashBits, const int inputBits) :
data(UINT64_C(1) << hashBits),
hashBits(hashBits),
inputBits(inputBits)
{
assert(hashBits > 0 && hashBits <= 24);
assert(inputBits > 0 && inputBits <= 8);
}
void reset() {
for (uint64_t i = 0; i < data.size(); ++i) {
data[i].reset();
}
}
void set(const uint64_t contextHash, const uint8_t c) {
assert(c < (1 << inputBits));
T* ptr = data[finalize64(contextHash, hashBits)].find(checksum16(contextHash, hashBits), nullptr);
*ptr = (*ptr) << inputBits | c;
};
T get(const uint64_t contextHash) {
return *data[finalize64(contextHash, hashBits)].find(checksum16(contextHash, hashBits), nullptr);
};
};

Xet Storage Details

Size:
986 Bytes
·
Xet hash:
7d1fe3fce0d0118d8fda35ecea2632d39a8a8eb736cd4fa1a1b61b4d85ecb988

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.