diff options
Diffstat (limited to 'vppinfra/vppinfra/qhash.h')
-rw-r--r-- | vppinfra/vppinfra/qhash.h | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/vppinfra/vppinfra/qhash.h b/vppinfra/vppinfra/qhash.h index f4ea9386b55..9dbbd971ade 100644 --- a/vppinfra/vppinfra/qhash.h +++ b/vppinfra/vppinfra/qhash.h @@ -42,7 +42,8 @@ #include <vppinfra/hash.h> /* Word hash tables. */ -typedef struct { +typedef struct +{ /* Number of elements in hash. */ u32 n_elts; @@ -52,26 +53,32 @@ typedef struct { u32 hash_seeds[3]; /* Fall back CLIB hash for overflow in fixed sized buckets. */ - uword * overflow_hash; + uword *overflow_hash; - u32 * overflow_counts, * overflow_free_indices; + u32 *overflow_counts, *overflow_free_indices; - u8 * hash_key_valid_bitmap; + u8 *hash_key_valid_bitmap; - uword * hash_keys; + uword *hash_keys; } qhash_t; always_inline qhash_t * -qhash_header (void * v) -{ return vec_header (v, sizeof (qhash_t)); } +qhash_header (void *v) +{ + return vec_header (v, sizeof (qhash_t)); +} always_inline uword -qhash_elts (void * v) -{ return v ? qhash_header (v)->n_elts : 0; } +qhash_elts (void *v) +{ + return v ? qhash_header (v)->n_elts : 0; +} always_inline uword -qhash_n_overflow (void * v) -{ return v ? hash_elts (qhash_header (v)->overflow_hash) : 0; } +qhash_n_overflow (void *v) +{ + return v ? hash_elts (qhash_header (v)->overflow_hash) : 0; +} #define QHASH_LOG2_KEYS_PER_BUCKET 2 #define QHASH_KEYS_PER_BUCKET (1 << QHASH_LOG2_KEYS_PER_BUCKET) @@ -97,7 +104,6 @@ qhash_hash_mix (qhash_t * h, uword key) #define qhash_resize(v,n) (v) = _qhash_resize ((v), (n), sizeof ((v)[0])) -/* FIXME */ #define qhash_foreach(var,v,body) #define qhash_set_multiple(v,keys,n,results) \ @@ -126,36 +132,38 @@ qhash_hash_mix (qhash_t * h, uword key) _qhash_unset_k; \ }) -void * -_qhash_resize (void * v, uword length, uword elt_bytes); +void *_qhash_resize (void *v, uword length, uword elt_bytes); /* Lookup multiple keys in the same hash table. */ void -qhash_get_multiple (void * v, +qhash_get_multiple (void *v, uword * search_keys, - uword n_search_keys, - u32 * result_indices); + uword n_search_keys, u32 * result_indices); /* Lookup multiple keys in the same hash table. Returns index of first matching key. */ u32 -qhash_get_first_match (void * v, +qhash_get_first_match (void *v, uword * search_keys, - uword n_search_keys, - uword * matching_key); + uword n_search_keys, uword * matching_key); /* Set/unset helper functions. */ -void * -_qhash_set_multiple (void * v, - uword elt_bytes, - uword * search_keys, - uword n_search_keys, - u32 * result_indices); +void *_qhash_set_multiple (void *v, + uword elt_bytes, + uword * search_keys, + uword n_search_keys, u32 * result_indices); void -_qhash_unset_multiple (void * v, +_qhash_unset_multiple (void *v, uword elt_bytes, uword * search_keys, - uword n_search_keys, - u32 * result_indices); + uword n_search_keys, u32 * result_indices); #endif /* included_qhash_h */ + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ |