summaryrefslogtreecommitdiffhomepage
path: root/include/stc/clist.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-31 18:55:08 +0100
committerTyge Løvset <[email protected]>2023-01-31 18:55:08 +0100
commitb677a0c3950b8294ba6458e682a885351273ac08 (patch)
treef309f7f7571fb588f0f65254d17fa09d678a8e3c /include/stc/clist.h
parenta24ecd6bbfffc2e0b75b8ed48fcb5306d367ad3e (diff)
downloadSTC-modified-b677a0c3950b8294ba6458e682a885351273ac08.tar.gz
STC-modified-b677a0c3950b8294ba6458e682a885351273ac08.zip
Converted all containers but the maps and examples to signed sizes and indices.
Diffstat (limited to 'include/stc/clist.h')
-rw-r--r--include/stc/clist.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/stc/clist.h b/include/stc/clist.h
index 4eac2954..283c8774 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -98,7 +98,7 @@ STC_API _cx_iter _cx_memb(_insert_at)(_cx_self* self, _cx_iter it, i_key
STC_API _cx_iter _cx_memb(_erase_at)(_cx_self* self, _cx_iter it);
STC_API _cx_iter _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2);
#if !defined i_no_cmp
-STC_API size_t _cx_memb(_remove)(_cx_self* self, _cx_raw val);
+STC_API intptr_t _cx_memb(_remove)(_cx_self* self, _cx_raw val);
STC_API _cx_iter _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, _cx_raw val);
STC_API int _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y);
STC_API int _cx_memb(_sort_cmp_)(const clist_VOID_node* x, const clist_VOID_node* y);
@@ -134,11 +134,11 @@ STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
#endif // !i_no_emplace
STC_INLINE _cx_self _cx_memb(_init)(void) { return c_LITERAL(_cx_self){NULL}; }
-STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n)
+STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, intptr_t n)
{ while (n--) _cx_memb(_push_back)(self, i_keyfrom(*raw++)); }
-STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, size_t n)
+STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, intptr_t n)
{ _cx_self cx = {0}; _cx_memb(_put_n)(&cx, raw, n); return cx; }
-STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return true; }
+STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, intptr_t n) { return true; }
STC_INLINE bool _cx_memb(_empty)(const _cx_self* self) { return self->last == NULL; }
STC_INLINE void _cx_memb(_clear)(_cx_self* self) { _cx_memb(_drop)(self); }
STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, i_key value)
@@ -150,9 +150,9 @@ STC_INLINE _cx_node* _cx_memb(_unlink_node_front)(_cx_self* self)
STC_INLINE _cx_value* _cx_memb(_front)(const _cx_self* self) { return &self->last->next->value; }
STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self) { return &self->last->value; }
-STC_INLINE size_t
+STC_INLINE intptr_t
_cx_memb(_count)(const _cx_self* self) {
- size_t n = 1; const _cx_node *node = self->last;
+ intptr_t n = 1; const _cx_node *node = self->last;
if (!node) return 0;
while ((node = node->next) != self->last) ++n;
return n;
@@ -414,9 +414,9 @@ _cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, _cx_raw val) {
it2.ref = NULL; return it2;
}
-STC_DEF size_t
+STC_DEF intptr_t
_cx_memb(_remove)(_cx_self* self, _cx_raw val) {
- size_t n = 0;
+ intptr_t n = 0;
_cx_node *prev = self->last, *node;
if (prev) do {
node = prev->next;