summaryrefslogtreecommitdiffhomepage
path: root/include/stc/carc.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-18 07:51:44 +0100
committerTyge Løvset <[email protected]>2023-02-18 07:51:44 +0100
commit0e3d07dbd991c1f1a691b24655c37ddab660a9d9 (patch)
treedc9801e2fc9f62cbe3eb32cc8897c65e3f25f78b /include/stc/carc.h
parentc4ae61de5be08e719e3183f4e2d1115c11856796 (diff)
downloadSTC-modified-0e3d07dbd991c1f1a691b24655c37ddab660a9d9.tar.gz
STC-modified-0e3d07dbd991c1f1a691b24655c37ddab660a9d9.zip
Fixed carc, cbox: no need for no_lookup and no_eq: use only no_cmp, no_hash if needed.
Diffstat (limited to 'include/stc/carc.h')
-rw-r--r--include/stc/carc.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index 82f8835d..d606ac6e 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -77,6 +77,9 @@ int main() {
#ifndef _i_prefix
#define _i_prefix carc_
#endif
+#ifdef i_eq
+#define _i_eq
+#endif
#include "priv/template.h"
typedef i_keyraw _cx_raw;
@@ -180,7 +183,7 @@ STC_INLINE int _cx_memb(_cmp)(const _cx_self* x, const _cx_self* y) {
}
#endif
-#ifndef i_no_eq
+#ifdef _i_eq
STC_INLINE bool _cx_memb(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry)
{ return i_eq(rx, ry); }
@@ -188,6 +191,12 @@ STC_INLINE bool _cx_memb(_eq)(const _cx_self* x, const _cx_self* y) {
_cx_raw rx = i_keyto(x->get), ry = i_keyto(y->get);
return i_eq((&rx), (&ry));
}
+#elif !defined i_no_cmp
+STC_INLINE bool _cx_memb(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry)
+ { return i_cmp(rx, ry) == 0; }
+
+STC_INLINE bool _cx_memb(_eq)(const _cx_self* x, const _cx_self* y)
+ { return _cx_memb(_cmp)(x, y) == 0; }
#endif
#ifndef i_no_hash
@@ -198,6 +207,7 @@ STC_INLINE uint64_t _cx_memb(_hash)(const _cx_self* x)
{ _cx_raw rx = i_keyto(x->get); return i_hash((&rx)); }
#endif
+#undef _i_eq
#undef _i_atomic_inc
#undef _i_atomic_dec_and_test
#include "priv/template.h"