4 #include <isl_stdint.h>
6 #if defined(__cplusplus)
10 #define isl_hash_init() (2166136261u)
11 #define isl_hash_byte(h,b) do { \
15 #define isl_hash_hash(h,h2) \
17 isl_hash_byte(h, (h2) & 0xFF); \
18 isl_hash_byte(h, ((h2) >> 8) & 0xFF); \
19 isl_hash_byte(h, ((h2) >> 16) & 0xFF); \
20 isl_hash_byte(h, ((h2) >> 24) & 0xFF); \
22 #define isl_hash_bits(h,bits) \
23 ((bits) == 32) ? (h) : \
25 ((h) >> (bits)) ^ ((h) & (((uint32_t)1 << (bits)) - 1)) : \
26 (((h) >> (bits)) ^ (h)) & (((uint32_t)1 << (bits)) - 1)
28 uint32_t isl_hash_string(uint32_t hash
, const char *s
);
30 struct isl_hash_table_entry
36 struct isl_hash_table
{
39 struct isl_hash_table_entry
*entries
;
44 struct isl_hash_table
*isl_hash_table_alloc(struct isl_ctx
*ctx
, int min_size
);
45 void isl_hash_table_free(struct isl_ctx
*ctx
, struct isl_hash_table
*table
);
47 int isl_hash_table_init(struct isl_ctx
*ctx
, struct isl_hash_table
*table
,
49 void isl_hash_table_clear(struct isl_hash_table
*table
);
50 struct isl_hash_table_entry
*isl_hash_table_find(struct isl_ctx
*ctx
,
51 struct isl_hash_table
*table
,
53 int (*eq
)(const void *entry
, const void *val
),
54 const void *val
, int reserve
);
55 void isl_hash_table_remove(struct isl_ctx
*ctx
,
56 struct isl_hash_table
*table
,
57 struct isl_hash_table_entry
*entry
);
59 #if defined(__cplusplus)