summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-11-03 13:20:59 +0100
committerTyge Løvset <[email protected]>2021-11-03 13:20:59 +0100
commit1790465d3dc002beafb91cc52d8aa6319dc67b35 (patch)
tree435fd45459b5bf1f71cdd95b88e411dd90c67f24 /include
parent27a6860137499e71eb23c1930ebe6e992baece12 (diff)
downloadSTC-modified-1790465d3dc002beafb91cc52d8aa6319dc67b35.tar.gz
STC-modified-1790465d3dc002beafb91cc52d8aa6319dc67b35.zip
Removed carrN_elem(). Added assert in carrN_at().
Diffstat (limited to 'include')
-rw-r--r--include/stc/carr2.h9
-rw-r--r--include/stc/carr3.h9
2 files changed, 8 insertions, 10 deletions
diff --git a/include/stc/carr2.h b/include/stc/carr2.h
index a1dfc3ce..b961c47e 100644
--- a/include/stc/carr2.h
+++ b/include/stc/carr2.h
@@ -76,11 +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(_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 const _cx_value *_cx_memb(_at)(const _cx_self* self, size_t x, size_t y) {
+ assert(x < self->xdim && y < self->ydim);
+ return *self->data + self->ydim*x + y;
+}
STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) {
if (self->data == other.data) return;
diff --git a/include/stc/carr3.h b/include/stc/carr3.h
index 4d4fc84e..3f230204 100644
--- a/include/stc/carr3.h
+++ b/include/stc/carr3.h
@@ -78,11 +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(_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 const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t x, size_t y, size_t z) {
+ assert(x < self->xdim && y < self->ydim && z < self->zdim);
+ return **self->data + self->zdim*(self->ydim*x + y) + z;
+}
STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) {
if (self->data == other.data) return;