17 size_t m_key_width = 0;
19 inline size_t key_width(uint64_t key) {
20 m_key_width = std::max(m_key_width,
size_t(
bits_for(key)));
26 Meta m(
"lz78trie",
"compact_sparse_hash",
"Compact Sparse Hash Trie");
54 auto& entry = m_table.
index(key, key_width(key));
59 return node_t(value,
true);
71 auto parent = parent_w.
id();
80 DCHECK_NE(newleaf_id, 0);
83 auto& val = m_table.
index(key, key_width(key));
86 DCHECK_EQ(val, newleaf_id);
95 inline size_t size()
const {
96 return m_table.
size();
Contains the text compression and encoding framework.
constexpr uint_fast8_t bits_for(size_t n)
Computes the number of bits required to store the given integer value.
CompactSparseHashTrie & operator=(CompactSparseHashTrie &&other)=default
uint8_t uliteral_t
Type to represent signed single literals.
val_t & index(uint64_t key, size_t key_width)
uint64_t zero_or_next_power_of_two(uint64_t x)
node_t find_or_insert(const node_t &parent_w, uliteral_t c)
Env & env()
Provides access to the environment that the algorithm works in.
Default return type of find_or_insert.
CompactSparseHashTrie(Env &&env, const size_t n, const size_t &remaining_characters, factorid_t reserve=0)
IF_STATS(MoveGuard m_guard;inline ~CompactSparseHashTrie() { if(m_guard) { } }) CompactSparseHashTrie(CompactSparseHashTrie &&other)=default
uint32_t factorid_t
Type for the factor indices, bounded by the number of LZ78 trie nodes.
squeeze_node_t create_node(factorid_t id, uliteral_t c)
Local environment for a compression/encoding/decompression call.
node_t get_rootnode(uliteral_t c) const
Interface for algorithms.
node_t add_rootnode(uliteral_t c)