summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/carray_api.md2
-rw-r--r--include/stc/carr2.h9
-rw-r--r--include/stc/carr3.h9
3 files changed, 8 insertions, 12 deletions
diff --git a/docs/carray_api.md b/docs/carray_api.md
index 65c4588f..aa9ea681 100644
--- a/docs/carray_api.md
+++ b/docs/carray_api.md
@@ -33,7 +33,6 @@ void carr2_X_del(carr2_X* self);
size_t carr2_X_size(carr2_X arr);
i_val* carr2_X_data(carr2_X* self); // access storage data
-i_val* carr2_X_elem(carr2_X* self, size_t x, size_t y);
const i_val* carr2_X_at(const carr2_X* self, size_t x, size_t y);
carr2_X_iter carr2_X_begin(const carr2_X* self);
@@ -52,7 +51,6 @@ void carr3_X_del(carr3_X* self);
size_t carr3_X_size(carr3_X arr);
i_val* carr3_X_data(carr3_X* self); // storage data
-i_val* carr3_X_elem(carr3_X* self, size_t x, size_t y, size_t z);
const i_val* carr3_X_at(const carr3_X* self, size_t x, size_t y, size_t z);
carr3_X_iter carr3_X_begin(const carr3_X* self);
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;