summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortylov <[email protected]>2023-08-13 14:14:25 +0200
committertylov <[email protected]>2023-08-13 14:14:25 +0200
commit1802558d41112e99d965000c97c45ebf7984d70c (patch)
tree2cc9d1dd337ad8783de7b8ac579cf144f2f54031
parentea878349e94ef00643b2510045f6482385cff1a7 (diff)
downloadSTC-modified-1802558d41112e99d965000c97c45ebf7984d70c.tar.gz
STC-modified-1802558d41112e99d965000c97c45ebf7984d70c.zip
Fixed cqueue.h: cqueue_X_copy() was not defined inside a `c_no_clone` check.
Reverted to 2X expansion for cvec to compete with gcc speed.
-rw-r--r--include/stc/cvec.h14
-rw-r--r--include/stc/priv/cqueue_hdr.h11
2 files changed, 12 insertions, 13 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index dc16e94a..12cd6875 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -94,13 +94,13 @@ STC_API _cx_iter _cx_MEMB(_binary_search_in)(_cx_iter it1, _cx_iter it2,
STC_INLINE void _cx_MEMB(_value_drop)(_cx_value* val) { i_keydrop(val); }
STC_INLINE _cx_value* _cx_MEMB(_push)(_cx_Self* self, i_key value) {
- if (self->_len == self->_cap)
- if (!_cx_MEMB(_reserve)(self, self->_len*3/2 + 4))
- return NULL;
- _cx_value *v = self->data + self->_len++;
- *v = value;
- return v;
-}
+ if (self->_len == self->_cap)
+ if (!_cx_MEMB(_reserve)(self, self->_len*2 + 4))
+ return NULL;
+ _cx_value *v = self->data + self->_len++;
+ *v = value;
+ return v;
+ }
#if !defined i_no_emplace
STC_API _cx_iter
diff --git a/include/stc/priv/cqueue_hdr.h b/include/stc/priv/cqueue_hdr.h
index 1cad8684..06f3bd74 100644
--- a/include/stc/priv/cqueue_hdr.h
+++ b/include/stc/priv/cqueue_hdr.h
@@ -59,6 +59,11 @@ STC_API bool _cx_MEMB(_eq)(const _cx_Self* self, const _cx_Self* othe
STC_API _cx_Self _cx_MEMB(_clone)(_cx_Self cx);
STC_INLINE i_key _cx_MEMB(_value_clone)(i_key val)
{ return i_keyclone(val); }
+STC_INLINE void _cx_MEMB(_copy)(_cx_Self* self, const _cx_Self* other) {
+ if (self->data == other->data) return;
+ _cx_MEMB(_drop)(self);
+ *self = _cx_MEMB(_clone)(*other);
+ }
#endif // !i_no_clone
STC_INLINE intptr_t _cx_MEMB(_size)(const _cx_Self* self)
{ return _cdeq_toidx(self, self->end); }
@@ -88,12 +93,6 @@ STC_INLINE _cx_value _cx_MEMB(_pull)(_cx_Self* self) { // move front out of queu
return self->data[s];
}
-STC_INLINE void _cx_MEMB(_copy)(_cx_Self* self, const _cx_Self* other) {
- if (self->data == other->data) return;
- _cx_MEMB(_drop)(self);
- *self = _cx_MEMB(_clone)(*other);
-}
-
STC_INLINE _cx_iter _cx_MEMB(_begin)(const _cx_Self* self) {
return c_LITERAL(_cx_iter){
.ref=_cx_MEMB(_empty)(self) ? NULL : self->data + self->start,