From 1b90b6c3eea0f3e07f8a2d2abe3686917d1d86a8 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 21 Dec 2021 10:56:01 +0100 Subject: Minor improvement. --- include/stc/cbox.h | 4 ++-- include/stc/csptr.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'include') 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); -- cgit v1.2.3