summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-03-16 02:16:38 +0100
committerGitHub <[email protected]>2020-03-16 02:16:38 +0100
commit7e6511637333d7f2703b1899a41616b88e719c6f (patch)
tree786e75d1be87aba646bc7befb96f1265d754e974
parent0e9d2ae98db4909913dfb9ae22f5606aae66b10d (diff)
downloadSTC-modified-7e6511637333d7f2703b1899a41616b88e719c6f.tar.gz
STC-modified-7e6511637333d7f2703b1899a41616b88e719c6f.zip
Update cmap.h
-rw-r--r--clib/cmap.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/clib/cmap.h b/clib/cmap.h
index 1c7f1d1b..1d5ee10b 100644
--- a/clib/cmap.h
+++ b/clib/cmap.h
@@ -41,7 +41,7 @@ struct CMapEntry_##tag { \
static inline void cmapentry_##tag##_destroy(struct CMapEntry_##tag* e) { \
keyDestroy(&e->key); \
valueDestroy(&e->value); \
- e->used = 0; \
+ e->used = false; \
} \
typedef struct CMapEntry_##tag CMapEntry_##tag
@@ -140,10 +140,10 @@ static inline CMapEntry_##tag* cmap_##tag##_put(CMap_##tag* self, KeyRaw rawKey,
size_t idx = cmap_##tag##_bucket(self, rawKey); \
CMapEntry_##tag* e = &self->_vec.data[idx]; \
if (e->used) \
- e->changed = 1; \
+ e->changed = true; \
else { \
e->key = keyInitRaw(rawKey); \
- e->used = 1; \
+ e->used = true; \
++self->_size; \
} \
e->value = value; \
@@ -180,14 +180,13 @@ static inline bool cmap_##tag##_erase(CMap_##tag* self, KeyRaw rawKey) { \
break; \
KeyRaw r = keyGetRaw(slot[j].key); \
k = c_reduce(keyHashRaw(&r, sizeof(KeyRaw)), cap); \
- /* https://attractivechaos.wordpress.com/2019/12/28/deletion-from-hash-tables-without-tombstones/ \
- if (j > i && (k <= i || k > j) || \
- j < i && (k <= i && k > j))*/ \
+ /* https://attractivechaos.wordpress.com/2019/12/28/deletion-from-hash-tables-without-tombstones/ */ \
+ /* if (j > i && (k <= i || k > j) || j < i && (k <= i && k > j)) */ \
if ((j < i) ^ (k <= i) ^ (k > j)) /* simplified */ \
slot[i] = slot[j], i = j; \
} while (true); \
cmapentry_##tag##_destroy(&slot[i]); \
- slot[i].used = 0; \
+ slot[i].used = false; \
--self->_size; \
return true; \
} \