summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-11-03 13:11:56 +0100
committerTyge Løvset <[email protected]>2021-11-03 13:11:56 +0100
commit27a6860137499e71eb23c1930ebe6e992baece12 (patch)
treee3df57ba03d38535b91e6451faa333454ebc2406 /include/stc
parent99979df6c500dbdea0ea7e202c7076db529d7e42 (diff)
downloadSTC-modified-27a6860137499e71eb23c1930ebe6e992baece12.tar.gz
STC-modified-27a6860137499e71eb23c1930ebe6e992baece12.zip
Changed carrN_X_at() to return const value*. Added mutable carrN_X_elem().
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/carr2.h5
-rw-r--r--include/stc/carr3.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/include/stc/carr2.h b/include/stc/carr2.h
index 3f9d1540..a1dfc3ce 100644
--- a/include/stc/carr2.h
+++ b/include/stc/carr2.h
@@ -76,7 +76,10 @@ STC_INLINE size_t _cx_memb(_size)(_cx_self arr)
STC_INLINE _cx_value *_cx_memb(_data)(_cx_self* self)
{ return *self->data; }
-STC_INLINE _cx_value *_cx_memb(_at)(_cx_self* self, size_t x, size_t y)
+STC_INLINE _cx_value *_cx_memb(_elem)(_cx_self* self, size_t x, size_t y)
+ { return *self->data + self->ydim*x + y; }
+
+STC_INLINE const _cx_value *_cx_memb(_at)(const _cx_self* self, size_t x, size_t y)
{ return *self->data + self->ydim*x + y; }
STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) {
diff --git a/include/stc/carr3.h b/include/stc/carr3.h
index 1133dcc3..4d4fc84e 100644
--- a/include/stc/carr3.h
+++ b/include/stc/carr3.h
@@ -78,7 +78,10 @@ STC_INLINE size_t _cx_memb(_size)(_cx_self arr)
STC_INLINE _cx_value* _cx_memb(_data)(_cx_self* self)
{ return **self->data; }
-STC_INLINE _cx_value* _cx_memb(_at)(_cx_self* self, size_t x, size_t y, size_t z)
+STC_INLINE _cx_value* _cx_memb(_elem)(_cx_self* self, size_t x, size_t y, size_t z)
+ { return **self->data + self->zdim*(self->ydim*x + y) + z; }
+
+STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t x, size_t y, size_t z)
{ return **self->data + self->zdim*(self->ydim*x + y) + z; }
STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) {