• Tony Finch's avatar
    trie: refactor to prepare for copy-on-write support · e7b7e187
    Tony Finch authored and Daniel Salzman's avatar Daniel Salzman committed
    No functional change.
    
    The point of this commit is to make it possible to stash a few
    flags in leaf nodes as well as branch nodes, though we don't
    yet exercise this possibility in any meaningful way.
    
    This fixes a foolish mistake in the original qp trie data structure
    declarations: the combination of unions and bitfields is a complete
    disaster for portability, and it gets into dangerous territory wrt
    compiler optimization. Instead, we just use a big enough word (uint64_t)
    which is broken up into fields using accessor macros and inline functions,
    and cast it to a pointer when necessary. We don't actually care about
    the detailed layout in memory, just the numeric value, so a union was
    the wrong tool.
    e7b7e187