ck_ht: Add ck_ht_entry_empty function.

Function returns true if the initialized ck_ht_entry_t
pointed to by its argument does not contain a key-value pair.
ck_pring
Samy Al Bahra 13 years ago
parent cef7de2c5f
commit fb5d9331e2

@ -52,6 +52,9 @@ struct ck_ht_entry {
} CK_CC_ALIGNED;
typedef struct ck_ht_entry ck_ht_entry_t;
#define CK_HT_KEY_EMPTY ((uintptr_t)0)
#define CK_HT_KEY_TOMBSTONE (~(uintptr_t)0)
struct ck_ht_map;
struct ck_ht {
struct ck_ht_map *map;
@ -77,6 +80,13 @@ ck_ht_iterator_init(struct ck_ht_iterator *iterator)
return;
}
CK_CC_INLINE static bool
ck_ht_entry_empty(ck_ht_entry_t *entry)
{
return entry->key == CK_HT_KEY_EMPTY;
}
CK_CC_INLINE static void
ck_ht_entry_key_set(ck_ht_entry_t *entry, const void *key, uint16_t key_length)
{

@ -56,9 +56,6 @@
#define CK_HT_PROBE_DEFAULT 64ULL
#endif
#define CK_HT_KEY_EMPTY ((uintptr_t)0)
#define CK_HT_KEY_TOMBSTONE (~(uintptr_t)0)
struct ck_ht_map {
enum ck_ht_mode mode;
uint64_t deletions;

Loading…
Cancel
Save