11 char *p_buffer = (
char *)p_hashtable;
12 const size_t data_size = p_hashtable->
data_size;
14 const size_t hashtable_element_size =
18 hashtable_element_size * entry_index);
25 const size_t hashtable_element_size =
28 const size_t size = hashtable_size + hashtable_element_size * num_entries;
32 ABTI_CHECK_ERROR(ret);
35 p_buffer += hashtable_size;
38 *pp_hashtable = p_hashtable;
59 const size_t num_entries = p_hashtable->
num_entries;
60 const size_t data_size = p_hashtable->
data_size;
61 const ssize_t entry_index_tmp = ((ssize_t)key) % ((ssize_t)num_entries);
62 const size_t entry_index = entry_index_tmp < 0
63 ? (ssize_t)(entry_index_tmp + num_entries)
64 : (ssize_t)entry_index_tmp;
66 if (!p_element->data) {
74 if (p_element->
key == key) {
76 memcpy(data, p_element->data, data_size);
81 }
else if (!p_element->
p_next) {
86 p_element = p_element->
p_next;
92 const void *data,
int *overwritten)
95 const size_t num_entries = p_hashtable->
num_entries;
96 const size_t data_size = p_hashtable->
data_size;
97 const ssize_t entry_index_tmp = ((ssize_t)key) % ((ssize_t)num_entries);
98 const size_t entry_index = entry_index_tmp < 0
99 ? (ssize_t)(entry_index_tmp + num_entries)
100 : (ssize_t)entry_index_tmp;
102 if (!p_element->data) {
104 p_element->
key = key;
106 memcpy(p_element->data, data, data_size);
113 if (p_element->
key == key) {
115 memcpy(p_element->data, data, data_size);
120 }
else if (!p_element->
p_next) {
121 const size_t hashtable_element_size =
127 (
void **)&p_new_element);
128 ABTI_CHECK_ERROR(ret);
129 p_new_element->key = key;
130 p_new_element->data =
132 memcpy(p_new_element->data, data, data_size);
133 p_element->
p_next = p_new_element;
138 p_element = p_element->
p_next;
146 const size_t num_entries = p_hashtable->
num_entries;
147 const size_t data_size = p_hashtable->
data_size;
148 const ssize_t entry_index_tmp = ((ssize_t)key) % ((ssize_t)num_entries);
149 const size_t entry_index = entry_index_tmp < 0
150 ? (ssize_t)(entry_index_tmp + num_entries)
151 : (ssize_t)entry_index_tmp;
153 if (!p_element->data) {
158 }
else if (p_element->
key == key) {
161 const size_t hashtable_element_size =
164 memcpy(p_element, p_next, hashtable_element_size);
170 p_element->data = NULL;
178 p_element = *pp_element;
180 if (p_element->
key == key) {
181 *pp_element = p_element->
p_next;
186 }
else if (!p_element->
p_next) {
191 pp_element = &p_element->
p_next;
192 p_element = *pp_element;