summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-06-21 19:48:05 +0200
committerTyge Løvset <[email protected]>2023-06-21 19:48:05 +0200
commit5096c3c951f6b99e9d6ee04a21531e226153cca9 (patch)
tree1c8c74bfd5eb75a0ab1d3a76ed3b0ed229930a0d /include/stc
parente27a51708bf1ee4b22842b4a0924b3ded26f630c (diff)
downloadSTC-modified-5096c3c951f6b99e9d6ee04a21531e226153cca9.tar.gz
STC-modified-5096c3c951f6b99e9d6ee04a21531e226153cca9.zip
Fix cbox carc default cmp and eq.
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/carc.h18
-rw-r--r--include/stc/cbox.h18
2 files changed, 14 insertions, 22 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index 3b60fe78..2096b968 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -77,8 +77,13 @@ int main() {
#endif // CARC_H_INCLUDED
#define _i_prefix carc_
-#ifdef i_eq
-#define _i_eq
+#if !defined i_cmp && !defined i_less && \
+ !defined i_valclass && !defined i_valboxed && \
+ !defined i_val_str && !defined i_val_ssv
+ #if !defined i_eq
+ #define i_eq(x, y) x == y
+ #endif
+ #define i_less(x, y) x < y
#endif
#include "priv/template.h"
typedef i_keyraw _cx_raw;
@@ -181,9 +186,7 @@ STC_INLINE int _cx_MEMB(_cmp)(const _cx_Self* self, const _cx_Self* other) {
_cx_raw rx = i_keyto(self->get), ry = i_keyto(other->get);
return i_cmp((&rx), (&ry));
}
-#endif
-#ifdef _i_eq
STC_INLINE bool _cx_MEMB(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry)
{ return i_eq(rx, ry); }
@@ -191,12 +194,6 @@ STC_INLINE bool _cx_MEMB(_eq)(const _cx_Self* self, const _cx_Self* other) {
_cx_raw rx = i_keyto(self->get), ry = i_keyto(other->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* self, const _cx_Self* other)
- { return _cx_MEMB(_cmp)(self, other) == 0; }
#endif
#ifndef i_no_hash
@@ -207,7 +204,6 @@ STC_INLINE uint64_t _cx_MEMB(_hash)(const _cx_Self* self)
{ _cx_raw rx = i_keyto(self->get); return i_hash((&rx)); }
#endif
-#undef _i_eq
#undef _i_atomic_inc
#undef _i_atomic_dec_and_test
#include "priv/template2.h"
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index 86283ad7..24de71d4 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -70,8 +70,13 @@ int main() {
#endif // CBOX_H_INCLUDED
#define _i_prefix cbox_
-#ifdef i_eq
-#define _i_eq
+#if !defined i_cmp && !defined i_less && \
+ !defined i_valclass && !defined i_valboxed && \
+ !defined i_val_str && !defined i_val_ssv
+ #if !defined i_eq
+ #define i_eq(x, y) x == y
+ #endif
+ #define i_less(x, y) x < y
#endif
#include "priv/template.h"
typedef i_keyraw _cx_raw;
@@ -167,9 +172,7 @@ STC_INLINE int _cx_MEMB(_cmp)(const _cx_Self* self, const _cx_Self* other) {
_cx_raw rx = i_keyto(self->get), ry = i_keyto(other->get);
return i_cmp((&rx), (&ry));
}
-#endif
-#ifdef _i_eq
STC_INLINE bool _cx_MEMB(_raw_eq)(const _cx_raw* rx, const _cx_raw* ry)
{ return i_eq(rx, ry); }
@@ -177,12 +180,6 @@ STC_INLINE bool _cx_MEMB(_eq)(const _cx_Self* self, const _cx_Self* other) {
_cx_raw rx = i_keyto(self->get), ry = i_keyto(other->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* self, const _cx_Self* other)
- { return _cx_MEMB(_cmp)(self, other) == 0; }
#endif
#ifndef i_no_hash
@@ -193,5 +190,4 @@ STC_INLINE uint64_t _cx_MEMB(_hash)(const _cx_Self* self)
{ _cx_raw rx = i_keyto(self->get); return i_hash((&rx)); }
#endif
-#undef _i_eq
#include "priv/template2.h"