Changeset 14c9aa6 in mainline for kernel/generic/include/adt
- Timestamp:
- 2012-07-27T13:40:19Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0949b7a
- Parents:
- 4ec9ea41
- Location:
- kernel/generic/include/adt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/cht.h
r4ec9ea41 r14c9aa6 40 40 #include <synch/rcu.h> 41 41 #include <macros.h> 42 #include <synch/workqueue.h> 42 43 43 44 typedef uintptr_t cht_ptr_t; … … 53 54 /** Set of operations for a concurrent hash table. */ 54 55 typedef struct cht_ops { 55 size_t (*hash)(c ht_link_t *node);56 size_t (*hash)(const cht_link_t *item); 56 57 size_t (*key_hash)(void *key); 57 58 bool (*equal)(const cht_link_t *item1, const cht_link_t *item2); … … 70 71 cht_ops_t *op; 71 72 73 size_t min_order; 72 74 cht_buckets_t *b; 73 75 cht_buckets_t *new_b; 76 77 work_t resize_work; 78 atomic_t resize_reqs; 74 79 75 atomic_t resize_reqs;76 80 atomic_t item_cnt; 77 81 } cht_t; … … 84 88 #define cht_read_unlock() rcu_read_unlock() 85 89 86 extern void cht_create(cht_t *h, size_t init_size, cht_ops_t *op);90 extern bool cht_create(cht_t *h, size_t init_size, size_t min_size, cht_ops_t *op); 87 91 extern void cht_destroy(cht_t *h); 88 92 89 93 extern cht_link_t *cht_find(cht_t *h, void *key); 90 94 extern cht_link_t *cht_find_lazy(cht_t *h, void *key); 95 extern cht_link_t *cht_find_next(cht_t *h, const cht_link_t *item); 96 extern cht_link_t *cht_find_next_lazy(cht_t *h, const cht_link_t *item); 97 91 98 extern void cht_insert(cht_t *h, cht_link_t *item); 92 99 extern bool cht_insert_unique(cht_t *h, cht_link_t *item); -
kernel/generic/include/adt/hash.h
r4ec9ea41 r14c9aa6 37 37 #include <stdint.h> 38 38 39 /** Produces a uniform hash affecting all output bits from the skewed input. 40 */ 39 /** Produces a uniform hash affecting all output bits from the skewed input. */ 41 40 static inline uint32_t hash_mix32(uint32_t hash) 42 41 { … … 55 54 } 56 55 57 /** Produces a uniform hash affecting all output bits from the skewed input. 58 */ 56 /** Produces a uniform hash affecting all output bits from the skewed input. */ 59 57 static inline uint64_t hash_mix64(uint64_t hash) 60 58 { … … 68 66 hash = hash * 0x27d4eb2d; 69 67 hash = hash ^ (hash >> 15); 68 return hash; 70 69 } 71 70 72 /** Produces a uniform hash affecting all output bits from the skewed input. 73 */ 71 /** Produces a uniform hash affecting all output bits from the skewed input. */ 74 72 static inline size_t hash_mix(size_t hash) 75 73 {
Note:
See TracChangeset
for help on using the changeset viewer.