|
Cyclone Scheme
0.28.0
|
Go to the documentation of this file. 1 #ifndef CYCLONE_CK_POLYFILL_H
2 #define CYCLONE_CK_POLYFILL_H
12 void *(*malloc)(size_t);
13 void *(*realloc)(
void *, size_t, size_t, bool);
14 void (*
free)(
void *, size_t, bool);
73 static inline uint64_t MurmurHash64A(
const void *key,
int len, uint64_t seed)
81 #define CK_HS_MODE_OBJECT 0
82 #define CK_HS_MODE_SPMC 0
101 #define CK_HS_HASH(hs, hs_hash, value) 0
136 #define CK_ARRAY_MODE_SPMC 0
154 struct ck_malloc *allocator,
unsigned int initial_length);
203 #define CK_ARRAY_FOREACH(a, i, b) \
204 pthread_mutex_lock(&((a)->lock)); \
205 int tmpc = (a)->hs->nitems; \
206 void **tmp = alloca(sizeof(void *) * tmpc); \
207 hashset_to_array((a)->hs, tmp); \
208 pthread_mutex_unlock(&((a)->lock)); \
209 if (tmpc > 0) { (*b) = tmp[0]; } \
210 for (unsigned int _ck_i = 0; \
212 _ck_i++, (*b) = tmp[_ck_i])
217 ck_pr_cas_ptr(
void *target,
void *old_value,
void *new_value);
223 ck_pr_cas_8(uint8_t *target, uint8_t old_value, uint8_t new_value);
bool ck_pr_cas_int(int *target, int old_value, int new_value)
Definition: ck-polyfill.c:148
void * ck_hs_get(ck_hs_t *, unsigned long, const void *)
Definition: ck-polyfill.c:41
int simple_hashset_add(simple_hashset_t set, symbol_type *key)
Definition: ck-polyfill.c:352
Definition: ck-polyfill.h:27
bool ck_hs_put(ck_hs_t *, unsigned long, const void *)
Definition: ck-polyfill.c:58
hashset_t hs
Definition: ck-polyfill.h:127
int ck_array_put_unique(ck_array_t *array, void *pointer)
Definition: ck-polyfill.c:102
size_t nbits
Definition: ck-polyfill.h:28
int simple_hashset_is_member(simple_hashset_t set, symbol_type *key)
Definition: ck-polyfill.c:361
void ck_polyfill_init()
Definition: ck-polyfill.c:20
void ck_pr_add_ptr(void *target, uintptr_t delta)
Definition: ck-polyfill.c:186
Definition: ck-polyfill.h:84
size_t capacity
Definition: ck-polyfill.h:31
bool ck_hs_init(ck_hs_t *, unsigned int, ck_hs_hash_cb_t *, ck_hs_compare_cb_t *, struct ck_malloc *, unsigned long, unsigned long)
Definition: ck-polyfill.c:30
void * ck_pr_load_ptr(const void *target)
Definition: ck-polyfill.c:214
struct simple_hashset_st * simple_hashset_t
Definition: ck-polyfill.h:39
size_t(* hash_func_t)(const char *, size_t)
Definition: ck-polyfill.h:20
void simple_hashset_set_hash_function(simple_hashset_t set, hash_func_t func)
Definition: ck-polyfill.c:294
size_t mask
Definition: ck-polyfill.h:29
size_t n_deleted_items
Definition: ck-polyfill.h:34
simple_hashset_t hs
Definition: ck-polyfill.h:86
void ck_pr_store_ptr(void *target, void *value)
Definition: ck-polyfill.c:243
size_t nitems
Definition: ck-polyfill.h:33
bool ck_array_init(ck_array_t *array, unsigned int mode, struct ck_malloc *allocator, unsigned int initial_length)
Definition: ck-polyfill.c:77
struct simple_hashset_item_st * items
Definition: ck-polyfill.h:32
Definition: ck-polyfill.h:131
Symbols are similar to strings, but only one instance of each unique symbol is created,...
Definition: types.h:788
struct hashmap_st * hashmap_t
Definition: ck-polyfill.h:43
Definition: ck-polyfill.h:125
bool ck_array_commit(ck_array_t *array)
Definition: ck-polyfill.c:138
bool ck_pr_cas_ptr(void *target, void *old_value, void *new_value)
Definition: ck-polyfill.c:160
hash_func_t hash_func
Definition: ck-polyfill.h:36
void ck_pr_add_8(uint8_t *target, uint8_t delta)
Definition: ck-polyfill.c:206
void ck_pr_add_int(int *target, int delta)
Definition: ck-polyfill.c:198
bool ck_hs_compare_cb_t(const void *, const void *)
Definition: ck-polyfill.h:99
int unused
Definition: ck-polyfill.h:132
bool ck_pr_cas_8(uint8_t *target, uint8_t old_value, uint8_t new_value)
Definition: ck-polyfill.c:173
pthread_mutex_t lock
Definition: ck-polyfill.h:126
pthread_mutex_t lock
Definition: ck-polyfill.h:85
symbol_type * item
Definition: ck-polyfill.h:24
bool ck_array_remove(ck_array_t *array, void *pointer)
Definition: ck-polyfill.c:122
int ck_pr_load_int(const int *target)
Definition: ck-polyfill.c:224
void simple_hashset_destroy(simple_hashset_t set)
Definition: ck-polyfill.c:286
Definition: ck-polyfill.h:22
Definition: ck-polyfill.h:11
simple_hashset_t simple_hashset_create(void)
Definition: ck-polyfill.c:264
unsigned long ck_hs_hash_cb_t(const void *, unsigned long)
Definition: ck-polyfill.h:94
uint8_t ck_pr_load_8(const uint8_t *target)
Definition: ck-polyfill.c:234
size_t hash
Definition: ck-polyfill.h:23
void(* free)(void *, size_t, bool)
Definition: ck-polyfill.h:14