SpiecsEngine
 
Loading...
Searching...
No Matches

◆ get()

template<size_t BITS>
void * scl::radix_trie< BITS, 3 >::get ( size_t k) const
inline

Get item by key.

Parameters
[in]kkey.
Returns
Returns value;

Definition at line 298 of file RadixTrie.h.

299 {
300 const size_t i1 = k >> (LEAF_BITS + INTERIOR_BITS);
301 const size_t i2 = (k >> LEAF_BITS) & (INTERIOR_LENGTH - 1);
302 const size_t i3 = k & (LEAF_LENGTH - 1);
303
304 if((k >> BITS) || m_Root->ptrs[i1] == nullptr || m_Root->ptrs[i1]->ptrs[i2] == nullptr)
305 {
306 return nullptr;
307 }
308
309 return reinterpret_cast<Leaf*>(m_Root->ptrs[i1]->ptrs[i2])->values[i3];
310 }
static constexpr size_t LEAF_LENGTH
leaf array length.
Definition RadixTrie.h:243
void * get(size_t k) const
Get item by key.
Definition RadixTrie.h:298
Node * m_Root
Root Node.
Definition RadixTrie.h:264
static constexpr size_t INTERIOR_LENGTH
interior array length.
Definition RadixTrie.h:233
static constexpr size_t INTERIOR_BITS
interior bits.
Definition RadixTrie.h:228
static constexpr size_t LEAF_BITS
leaf bits.
Definition RadixTrie.h:238
std::array< Node *, INTERIOR_LENGTH > ptrs
Definition RadixTrie.h:250