32 static constexpr size_t SYMBOL_BITS =
sizeof(symbol_t) * 8;
33 static constexpr symbol_t HIGH_BIT = ((symbol_t) 1) << (SYMBOL_BITS - 1);
34 static constexpr symbol_t FULL_SYMBOL = ~((symbol_t) 0);
38 static constexpr size_t K = 14;
40 template <
typename T,
typename H>
41 friend struct geom::Digest;
52 void _push_back(symbol_t
s);
57 const symbol_t* _data()
const;
59 symbol_t operator[](
size_t i)
const;
97 const symbol_t*
bytes()
const {
return _data(); }
109struct geom::Digest<entttree::Position,H> {
112 H nonce = geom::truncated_constant<H>(0x249707f545e427faULL, 0x5905299ebf487d2b);
113 return geom::hash_bytes<H>(
116 pos._size *
sizeof(symbol_t)
123struct std::hash<entttree::Position> {
Common type aliases, enumerations, and utility functions used throughout entttree.
A system for maintaining parent-child relationships on entities.
A fractional index with strong ordering, used for sibling positioning.
static Position from_bytes(const symbol_t *data, size_t count)
Construct a Position from raw symbol bytes.
const symbol_t * bytes() const
Read-only pointer to the raw symbol bytes (big-endian, high-order first).
symbol_t * _symbol_ptr
Heap pointer when size exceeds K.
Position()
Construct a Position at the midpoint (0.5).
Position after() const
Return a position immediately after this one.
Position before() const
Return a position immediately before this one.
std::strong_ordering operator<=>(const Position &other) const
Lexicographic three-way comparison.
size_t byte_count() const
Number of symbols in the fractional-index representation.
Position between(const Position &other) const
Return a position midway between this position and other.