#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "list.h"
Go to the source code of this file.
|
| bool | hash_init (struct hash *, hash_hash_func *, hash_less_func *, void *aux) |
| |
| void | hash_clear (struct hash *, hash_action_func *) |
| |
| void | hash_destroy (struct hash *, hash_action_func *) |
| |
| struct hash_elem * | hash_insert (struct hash *, struct hash_elem *) |
| |
| struct hash_elem * | hash_replace (struct hash *, struct hash_elem *) |
| |
| struct hash_elem * | hash_find (struct hash *, struct hash_elem *) |
| |
| struct hash_elem * | hash_delete (struct hash *, struct hash_elem *) |
| |
| void | hash_apply (struct hash *, hash_action_func *) |
| |
| void | hash_first (struct hash_iterator *, struct hash *) |
| |
| struct hash_elem * | hash_next (struct hash_iterator *) |
| |
| struct hash_elem * | hash_cur (struct hash_iterator *) |
| |
| size_t | hash_size (struct hash *) |
| |
| bool | hash_empty (struct hash *) |
| |
| uint64_t | hash_bytes (const void *, size_t) |
| |
| uint64_t | hash_string (const char *) |
| |
| uint64_t | hash_int (int) |
| |
◆ hash_entry
| #define hash_entry |
( |
|
HASH_ELEM, |
|
|
|
STRUCT, |
|
|
|
MEMBER |
|
) |
| |
Value:
#define offsetof(TYPE, MEMBER)
Definition: stddef.h:5
unsigned char uint8_t
Definition: stdint.h:20
◆ hash_action_func
| typedef void hash_action_func(struct hash_elem *e, void *aux) |
◆ hash_hash_func
◆ hash_less_func
◆ hash_apply()
153 {
154 size_t i;
155
157
161
165 }
166 }
167}
#define ASSERT(CONDITION)
Definition: debug.h:30
#define list_elem_to_hash_elem(LIST_ELEM)
Definition: hash.c:12
static int next(int pos)
Definition: intq.c:74
struct list_elem * list_begin(struct list *)
Definition: list.c:68
struct list_elem * list_next(struct list_elem *)
Definition: list.c:77
struct list_elem * list_end(struct list *)
Definition: list.c:88
#define NULL
Definition: stddef.h:4
void * aux
Definition: hash.h:64
size_t bucket_cnt
Definition: hash.h:60
struct list * buckets
Definition: hash.h:61
◆ hash_bytes()
246 {
247
248 const unsigned char *buf = buf_;
250
252
256
258}
#define FNV_64_PRIME
Definition: hash.c:241
#define FNV_64_BASIS
Definition: hash.c:242
uint16_t size
Definition: mmu.h:0
unsigned long long int uint64_t
Definition: stdint.h:29
◆ hash_clear()
51 {
52 size_t i;
53
56
57 if (destructor !=
NULL)
62 }
63
65 }
66
68}
struct list_elem * list_pop_front(struct list *)
Definition: list.c:251
void list_init(struct list *)
Definition: list.c:58
bool list_empty(struct list *)
Definition: list.c:296
size_t elem_cnt
Definition: hash.h:59
◆ hash_cur()
224 {
226}
struct hash_elem * elem
Definition: hash.h:71
◆ hash_delete()
137 {
142 }
143 return found;
144}
static void remove_elem(struct hash *, struct hash_elem *)
Definition: hash.c:392
static struct hash_elem * find_elem(struct hash *, struct list *, struct hash_elem *)
Definition: hash.c:291
static struct list * find_bucket(struct hash *, struct hash_elem *)
Definition: hash.c:283
static void rehash(struct hash *)
Definition: hash.c:324
◆ hash_destroy()
81 {
82 if (destructor !=
NULL)
85}
void hash_clear(struct hash *h, hash_action_func *destructor)
Definition: hash.c:51
void free(void *)
Definition: malloc.c:202
◆ hash_empty()
◆ hash_find()
◆ hash_first()
187 {
190
194}
struct list_elem * list_head(struct list *)
Definition: list.c:141
struct hash * hash
Definition: hash.h:69
struct list * bucket
Definition: hash.h:70
◆ hash_init()
26 {
33
36 return true;
37 } else
38 return false;
39}
void * malloc(size_t) __attribute__((malloc))
Definition: malloc.c:85
hash_less_func * less
Definition: hash.h:63
hash_hash_func * hash
Definition: hash.h:62
◆ hash_insert()
94 {
97
100
102
103 return old;
104}
static void insert_elem(struct hash *, struct list *, struct hash_elem *)
Definition: hash.c:385
◆ hash_int()
277 {
279}
uint64_t hash_bytes(const void *buf_, size_t size)
Definition: hash.c:246
◆ hash_next()
205 {
207
212 break;
213 }
215 }
216
218}
struct list_elem list_elem
Definition: hash.h:30
◆ hash_replace()
109 {
112
116
118
119 return old;
120}
◆ hash_size()
◆ hash_string()
262 {
263 const unsigned char *
s = (
const unsigned char *) s_;
265
267
271
273}
static uint8_t s[256]
Definition: random.c:17