aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/map.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-05 08:53:38 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-05 08:55:25 +0200
commitfd5ddb3db9f50411ca579d84f225f265ca35b56a (patch)
treeb659112cc0e2abd6c7edb08b0938c0d2de4ca066 /src/solvers/h48/map.h
parentc9e2d6466e42d6b779ac9ffa7c5ee9a9c7558df8 (diff)
downloadnissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.tar.gz
nissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.zip
Rename constants from _underscore to CAPS
Diffstat (limited to 'src/solvers/h48/map.h')
-rw-r--r--src/solvers/h48/map.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h
index 0e9f926..34416fc 100644
--- a/src/solvers/h48/map.h
+++ b/src/solvers/h48/map.h
@@ -15,15 +15,15 @@ typedef struct {
15 uint64_t val; 15 uint64_t val;
16} kvpair_t; 16} kvpair_t;
17 17
18_static void h48map_create(h48map_t *, uint64_t, uint64_t); 18STATIC void h48map_create(h48map_t *, uint64_t, uint64_t);
19_static void h48map_clear(h48map_t *); 19STATIC void h48map_clear(h48map_t *);
20_static void h48map_destroy(h48map_t *); 20STATIC void h48map_destroy(h48map_t *);
21_static uint64_t h48map_lookup(h48map_t *, uint64_t); 21STATIC uint64_t h48map_lookup(h48map_t *, uint64_t);
22_static void h48map_insertmin(h48map_t *, uint64_t, uint64_t); 22STATIC void h48map_insertmin(h48map_t *, uint64_t, uint64_t);
23_static uint64_t h48map_value(h48map_t *, uint64_t); 23STATIC uint64_t h48map_value(h48map_t *, uint64_t);
24_static kvpair_t h48map_nextkvpair(h48map_t *, uint64_t *); 24STATIC kvpair_t h48map_nextkvpair(h48map_t *, uint64_t *);
25 25
26_static void 26STATIC void
27h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer) 27h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer)
28{ 28{
29 map->capacity = capacity; 29 map->capacity = capacity;
@@ -33,20 +33,20 @@ h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer)
33 h48map_clear(map); 33 h48map_clear(map);
34} 34}
35 35
36_static void 36STATIC void
37h48map_clear(h48map_t *map) 37h48map_clear(h48map_t *map)
38{ 38{
39 memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); 39 memset(map->table, 0xFF, map->capacity * sizeof(uint64_t));
40 map->n = 0; 40 map->n = 0;
41} 41}
42 42
43_static void 43STATIC void
44h48map_destroy(h48map_t *map) 44h48map_destroy(h48map_t *map)
45{ 45{
46 free(map->table); 46 free(map->table);
47} 47}
48 48
49_static_inline uint64_t 49STATIC_INLINE uint64_t
50h48map_lookup(h48map_t *map, uint64_t x) 50h48map_lookup(h48map_t *map, uint64_t x)
51{ 51{
52 uint64_t hash, i; 52 uint64_t hash, i;
@@ -60,7 +60,7 @@ h48map_lookup(h48map_t *map, uint64_t x)
60 return i; 60 return i;
61} 61}
62 62
63_static_inline void 63STATIC_INLINE void
64h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val) 64h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val)
65{ 65{
66 uint64_t i, oldval, min; 66 uint64_t i, oldval, min;
@@ -73,13 +73,13 @@ h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val)
73 map->table[i] = (key & MAP_KEYMASK) | (min << MAP_KEYSHIFT); 73 map->table[i] = (key & MAP_KEYMASK) | (min << MAP_KEYSHIFT);
74} 74}
75 75
76_static_inline uint64_t 76STATIC_INLINE uint64_t
77h48map_value(h48map_t *map, uint64_t key) 77h48map_value(h48map_t *map, uint64_t key)
78{ 78{
79 return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; 79 return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT;
80} 80}
81 81
82_static kvpair_t 82STATIC kvpair_t
83h48map_nextkvpair(h48map_t *map, uint64_t *p) 83h48map_nextkvpair(h48map_t *map, uint64_t *p)
84{ 84{
85 kvpair_t kv; 85 kvpair_t kv;

Generated with cgit - Back to sebastiano.tronto.net