summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-08-11 00:05:39 +0200
committerTyge Lovset <[email protected]>2022-08-11 00:05:39 +0200
commit35f63cb6d76f47a00daa5929808d75f715566657 (patch)
tree3be2f910275e37510530d28f20b3f74952c5877b /include
parent0604d29a95d77f5dc9aeb4813e126a3831062648 (diff)
downloadSTC-modified-35f63cb6d76f47a00daa5929808d75f715566657.tar.gz
STC-modified-35f63cb6d76f47a00daa5929808d75f715566657.zip
Code formatting only.
Diffstat (limited to 'include')
-rw-r--r--include/stc/carr2.h11
-rw-r--r--include/stc/carr3.h11
-rw-r--r--include/stc/cdeq.h22
-rw-r--r--include/stc/clist.h5
-rw-r--r--include/stc/cstack.h13
-rw-r--r--include/stc/cvec.h26
6 files changed, 57 insertions, 31 deletions
diff --git a/include/stc/carr2.h b/include/stc/carr2.h
index f15c6034..1762b8ad 100644
--- a/include/stc/carr2.h
+++ b/include/stc/carr2.h
@@ -88,14 +88,17 @@ STC_INLINE size_t _cx_memb(_idx)(const _cx_self* self, size_t x, size_t y) {
return self->ydim*x + y;
}
-STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
- { size_t n = self->xdim*self->ydim; return c_make(_cx_iter){n ? *self->data : NULL, *self->data + n}; }
+
+STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
+ size_t n = self->xdim*self->ydim;
+ return c_make(_cx_iter){n ? *self->data : NULL, *self->data + n};
+}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
{ return c_make(_cx_iter){NULL, *self->data + self->xdim*self->ydim}; }
-STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; }
-
+STC_INLINE void _cx_memb(_next)(_cx_iter* it)
+ { if (++it->ref == it->_end) it->ref = NULL; }
/* -------------------------- IMPLEMENTATION ------------------------- */
#if defined(i_implement)
diff --git a/include/stc/carr3.h b/include/stc/carr3.h
index ec67645c..4de21208 100644
--- a/include/stc/carr3.h
+++ b/include/stc/carr3.h
@@ -91,14 +91,17 @@ STC_INLINE size_t _cx_memb(_idx)(const _cx_self* self, size_t x, size_t y, size_
return self->zdim*(self->ydim*x + y) + z;
}
-STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
- { size_t n = _cx_memb(_size)(self); return c_make(_cx_iter){n ? **self->data : NULL, **self->data + n}; }
+
+STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
+ size_t n = _cx_memb(_size)(self);
+ return c_make(_cx_iter){n ? **self->data : NULL, **self->data + n};
+}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
{ return c_make(_cx_iter){NULL, **self->data + _cx_memb(_size)(self)}; }
-STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; }
-
+STC_INLINE void _cx_memb(_next)(_cx_iter* it)
+ { if (++it->ref == it->_end) it->ref = NULL; }
/* -------------------------- IMPLEMENTATION ------------------------- */
#if defined(i_implement)
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index d08e0155..644af838 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -92,13 +92,6 @@ STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self)
{ return self->data + cdeq_rep_(self)->size - 1; }
STC_INLINE void _cx_memb(_pop_front)(_cx_self* self) // == _pop() when _i_queue
{ i_keydrop(self->data); ++self->data; --cdeq_rep_(self)->size; }
-STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
- { size_t n = cdeq_rep_(self)->size; return c_make(_cx_iter){n ? self->data : NULL, self->data + n}; }
-STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
- { return c_make(_cx_iter){NULL, self->data + cdeq_rep_(self)->size}; }
-STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t offs)
- { if ((it.ref += offs) >= it._end) it.ref = NULL; return it; }
#if !defined _i_queue
@@ -143,6 +136,21 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter i1, _cx_iter i2) {
return _cx_memb(_erase_range_p)(self, i1.ref, (i2.ref ? i2.ref : i2._end));
}
+
+STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
+ size_t n = cdeq_rep_(self)->size;
+ return c_make(_cx_iter){n ? self->data : NULL, self->data + n};
+}
+
+STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
+ { return c_make(_cx_iter){NULL, self->data + cdeq_rep_(self)->size}; }
+
+STC_INLINE void _cx_memb(_next)(_cx_iter* it)
+ { if (++it->ref == it->_end) it->ref = NULL; }
+
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
+ { if ((it.ref += n) >= it._end) it.ref = NULL; return it; }
+
#if !defined _i_no_emplace
STC_INLINE _cx_value*
_cx_memb(_emplace_front)(_cx_self* self, _cx_raw raw) {
diff --git a/include/stc/clist.h b/include/stc/clist.h
index 229db32c..5b9cf0d3 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -159,9 +159,8 @@ _cx_memb(_begin)(const _cx_self* self) {
}
STC_INLINE _cx_iter
-_cx_memb(_end)(const _cx_self* self) {
- return c_make(_cx_iter){NULL};
-}
+_cx_memb(_end)(const _cx_self* self)
+ { return c_make(_cx_iter){NULL}; }
STC_INLINE void
_cx_memb(_next)(_cx_iter* it) {
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 811479c4..a524b71c 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -169,15 +169,18 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val)
{ return i_keyto(val); }
#endif // !_i_no_clone
-STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
- { return c_make(_cx_iter){self->size ? (_cx_value*)self->data : NULL, (_cx_value*)self->data + self->size}; }
+STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
+ return c_make(_cx_iter){self->size ? (_cx_value*)self->data : NULL,
+ (_cx_value*)self->data + self->size};
+}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
{ return c_make(_cx_iter){NULL, (_cx_value*)self->data + self->size}; }
-STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; }
+STC_INLINE void _cx_memb(_next)(_cx_iter* it)
+ { if (++it->ref == it->_end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t offs)
- { if ((it.ref += offs) >= it._end) it.ref = NULL ; return it; }
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
+ { if ((it.ref += n) >= it._end) it.ref = NULL ; return it; }
#include "template.h"
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 99df920c..a457c3dc 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -136,14 +136,6 @@ STC_INLINE void _cx_memb(_pop)(_cx_self* self)
STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, i_key value)
{ return _cx_memb(_push)(self, value); }
STC_INLINE void _cx_memb(_pop_back)(_cx_self* self) { _cx_memb(_pop)(self); }
-STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self)
- { size_t n = cvec_rep_(self)->size; return c_make(_cx_iter){n ? self->data : NULL, self->data + n}; }
-STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
- { return c_make(_cx_iter){NULL, self->data + cvec_rep_(self)->size}; }
-STC_INLINE void _cx_memb(_next)(_cx_iter* it) { if (++it->ref == it->_end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t offs)
- { if ((it.ref += offs) >= it._end) it.ref = NULL; return it; }
-STC_INLINE size_t _cx_memb(_index)(const _cx_self* cx, _cx_iter it) { return it.ref - cx->data; }
STC_INLINE _cx_self
_cx_memb(_with_size)(const size_t size, i_key null) {
@@ -204,6 +196,24 @@ _cx_memb(_at_mut)(_cx_self* self, const size_t idx) {
assert(idx < cvec_rep_(self)->size); return self->data + idx;
}
+
+STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
+ size_t n = cvec_rep_(self)->size;
+ return c_make(_cx_iter){n ? self->data : NULL, self->data + n};
+}
+
+STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
+ { return c_make(_cx_iter){NULL, self->data + cvec_rep_(self)->size}; }
+
+STC_INLINE void _cx_memb(_next)(_cx_iter* it)
+ { if (++it->ref == it->_end) it->ref = NULL; }
+
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
+ { if ((it.ref += n) >= it._end) it.ref = NULL; return it; }
+
+STC_INLINE size_t _cx_memb(_index)(const _cx_self* cx, _cx_iter it)
+ { return it.ref - cx->data; }
+
#if !c_option(c_no_cmp)
STC_INLINE _cx_iter