summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cmap.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-10-04 08:08:24 +0200
committerTyge Løvset <[email protected]>2021-10-04 08:08:24 +0200
commitd314fa40bcfc3a7d5e4dfc8136aebff309db8667 (patch)
tree0e10755092f5754d9bd43374750b413dec332798 /include/stc/cmap.h
parent882e173a2cc9a09c3a96a330f981daa11e34e0d0 (diff)
downloadSTC-modified-d314fa40bcfc3a7d5e4dfc8136aebff309db8667.tar.gz
STC-modified-d314fa40bcfc3a7d5e4dfc8136aebff309db8667.zip
Removed c_apply_pair_n() macro. Small improvements in examples.
Diffstat (limited to 'include/stc/cmap.h')
-rw-r--r--include/stc/cmap.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index 1cb61d00..203f0e79 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -162,11 +162,9 @@ cx_memb(_insert)(Self* self, i_key _key cx_MAP_ONLY(, i_val _mapped)) {
STC_INLINE cx_iter_t
cx_memb(_find)(const Self* self, i_keyraw rkey) {
- cx_size_t idx = self->bucket_count;
- if (self->size) {
- chash_bucket_t b = cx_memb(_bucket_)(self, &rkey);
- if (self->_hashx[b.idx]) idx = b.idx;
- }
+ cx_size_t idx;
+ if (!(self->size && self->_hashx[idx = cx_memb(_bucket_)(self, &rkey).idx]))
+ idx = self->bucket_count;
return c_make(cx_iter_t){self->table+idx, self->_hashx+idx};
}