diff options
| author | Tyge Løvset <[email protected]> | 2022-10-21 09:26:13 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-10-21 09:26:13 +0200 |
| commit | 2cefae32252f3051f75f44f4718a62a1210bd3a7 (patch) | |
| tree | be09d9f91e918ad36a21e5919200e8343b3e0884 /include | |
| parent | 650f6218c1b2afce696b2dd7e98c76dcdeafce24 (diff) | |
| download | STC-modified-2cefae32252f3051f75f44f4718a62a1210bd3a7.tar.gz STC-modified-2cefae32252f3051f75f44f4718a62a1210bd3a7.zip | |
Fixed wrong formatting of 64bit values various places.
Finialized cbox/carc issues.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/carc.h | 20 | ||||
| -rw-r--r-- | include/stc/cbox.h | 20 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 1 | ||||
| -rw-r--r-- | include/stc/template.h | 6 |
4 files changed, 26 insertions, 21 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h index cbe2e9e7..7209eb28 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -81,7 +81,7 @@ int main() { #if !(defined i_cmp || defined i_less || defined i_key_class || defined i_val_class) #define _i_no_cmp #endif -#if !(defined i_eq || defined i_hash) +#if !(defined i_eq || defined i_hash || defined i_key_class || defined i_val_class) #define _i_no_hash #endif #include "template.h" @@ -174,15 +174,6 @@ STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self ptr) { *self = ptr; } -STC_INLINE uint64_t _cx_memb(_value_hash)(const _cx_value* x) { - #if defined _i_no_hash - return (uint64_t)x; - #else - _cx_raw rx = i_keyto(x); - return i_hash((&rx)); - #endif -} - STC_INLINE int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #if defined _i_no_cmp return c_default_cmp(&x, &y); @@ -192,6 +183,15 @@ STC_INLINE int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #endif } +STC_INLINE uint64_t _cx_memb(_value_hash)(const _cx_value* x) { + #if defined _i_no_hash + return (uintptr_t)x; + #else + _cx_raw rx = i_keyto(x); + return i_hash((&rx)); + #endif +} + STC_INLINE bool _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) { #if defined _i_no_hash return x == y; diff --git a/include/stc/cbox.h b/include/stc/cbox.h index fbd19c50..17ec026f 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -73,7 +73,7 @@ int main() { #if !(defined i_cmp || defined i_less || defined i_key_class || defined i_val_class) #define _i_no_cmp #endif -#if !(defined i_eq || defined i_hash) +#if !(defined i_eq || defined i_hash || defined i_key_class || defined i_val_class) #define _i_no_hash #endif #include "template.h" @@ -148,15 +148,6 @@ STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self other) { *self = other; } -STC_INLINE uint64_t _cx_memb(_value_hash)(const _cx_value* x) { - #if defined _i_no_hash - return (uint64_t)x; - #else - _cx_raw rx = i_keyto(x); - return i_hash((&rx)); - #endif -} - STC_INLINE int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #if defined _i_no_cmp return c_default_cmp(&x, &y); @@ -166,6 +157,15 @@ STC_INLINE int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) { #endif } +STC_INLINE uint64_t _cx_memb(_value_hash)(const _cx_value* x) { + #if defined _i_no_hash + return (uintptr_t)x; + #else + _cx_raw rx = i_keyto(x); + return i_hash((&rx)); + #endif +} + STC_INLINE bool _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) { #if defined _i_no_hash return x == y; diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 52c05693..5ecb42f8 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -111,6 +111,7 @@ #define c_no_atomic (1<<1) #define c_no_clone (1<<2) #define c_no_cmp (1<<3) +#define c_no_hash (1<<4) /* Generic algorithms */ diff --git a/include/stc/template.h b/include/stc/template.h index 769c07c9..55201526 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -163,6 +163,9 @@ #if c_option(c_no_cmp) #define _i_no_cmp #endif +#if c_option(c_no_hash) + #define _i_no_hash +#endif #if c_option(c_no_clone) || (!defined i_keyclone && (defined i_keydrop || defined i_keyraw)) #define _i_no_clone #endif @@ -291,6 +294,7 @@ #undef i_val_ssv #undef i_val_arcbox #undef i_val_class +#undef i_val_bind // [deprecated] #undef i_valraw #undef i_valclone #undef i_valfrom @@ -302,6 +306,7 @@ #undef i_key_ssv #undef i_key_arcbox #undef i_key_class +#undef i_key_bind // [deprecated] #undef i_keyraw #undef i_keyclone #undef i_keyfrom @@ -320,6 +325,5 @@ #undef _i_no_cmp #undef _i_no_clone #undef _i_no_emplace -#undef _i_no_hash #undef _i_template #endif |
