|
C Container Collection (CCC)
|
#include <private_flat_hash_map.h>
If we only make these complex checks once, it is easier to read and used the source code during all the platform based implementations. else we define nothing and the portable fallback will take effect.
An array of this byte will be in the tag array. Same idea as Rust's Hashbrown table. The only value not represented by constants is the following:
DELETED = 0b10000000 EMPTY = 0x11111111 OCCUPIED = 0b0???????
In this case ? represents any 7 bits kept from the upper 7 bits of the original hash code to signify an occupied slot. We know this slot is taken because the Most Significant Bit is zero, something that is not true of any other state. Wrap a byte in a struct to avoid strict-aliasing exceptions that are granted to uint8_t (usually unsigned char) and int8_t (usually char) when passed to functions as pointers. Maybe nets performance gain but depends on aggressiveness of compiler.
Data Fields | |
| uint8_t | v |
| uint8_t CCC_Flat_hash_map_tag::v |
Can be set to DELETED or EMPTY or an arbitrary hash 0b0???????.