summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-21 10:56:01 +0100
committerTyge Løvset <[email protected]>2021-12-21 10:56:01 +0100
commit1b90b6c3eea0f3e07f8a2d2abe3686917d1d86a8 (patch)
treebdd40dc2f42916f57778a1bea1dc755f31a9279a /include
parent99f677c8bdee5c243c1415ffc00cf7bae76f80b4 (diff)
downloadSTC-modified-1b90b6c3eea0f3e07f8a2d2abe3686917d1d86a8.tar.gz
STC-modified-1b90b6c3eea0f3e07f8a2d2abe3686917d1d86a8.zip
Minor improvement.
Diffstat (limited to 'include')
-rw-r--r--include/stc/cbox.h4
-rw-r--r--include/stc/csptr.h5
2 files changed, 5 insertions, 4 deletions
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index f33e89bd..bcd9bd8c 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -129,7 +129,7 @@ _cx_memb(_reset_new)(_cx_self* self, i_val val) {
STC_INLINE void
_cx_memb(_copy)(_cx_self* self, _cx_self other) {
if (self->get == other.get) return;
- _cx_memb(_reset)(self);
+ _cx_memb(_drop)(self);
*self = _cx_memb(_clone)(other);
}
#endif
@@ -142,7 +142,7 @@ _cx_memb(_take)(_cx_self* self, _cx_self other) {
STC_INLINE uint64_t
_cx_memb(_hash)(const _cx_self* self, size_t n) {
- #if c_option(c_no_cmp) && SIZE_MAX >> 32
+ #if c_option(c_no_cmp) && UINTPTR_MAX == UINT64_MAX
return c_hash64(&self->get, 8);
#elif c_option(c_no_cmp)
return c_hash32(&self->get, 4);
diff --git a/include/stc/csptr.h b/include/stc/csptr.h
index 4c35c06b..92ed05ef 100644
--- a/include/stc/csptr.h
+++ b/include/stc/csptr.h
@@ -156,7 +156,8 @@ _cx_memb(_clone)(_cx_self ptr) {
STC_INLINE void
_cx_memb(_copy)(_cx_self* self, _cx_self ptr) {
if (ptr.use_count) _i_atomic_inc(ptr.use_count);
- _cx_memb(_drop)(self); *self = ptr;
+ _cx_memb(_drop)(self);
+ *self = ptr;
}
STC_INLINE void
@@ -167,7 +168,7 @@ _cx_memb(_take)(_cx_self* self, _cx_self ptr) {
STC_INLINE uint64_t
_cx_memb(_hash)(const _cx_self* self, size_t n) {
- #if c_option(c_no_cmp) && SIZE_MAX >> 32
+ #if c_option(c_no_cmp) && UINTPTR_MAX == UINT64_MAX
return c_hash64(&self->get, 8);
#elif c_option(c_no_cmp)
return c_hash32(&self->get, 4);