summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-11-20 08:36:02 +0100
committerTyge Løvset <[email protected]>2021-11-20 08:36:02 +0100
commit835a3a974f4f79ca789d6fca6c9745b4f4931870 (patch)
tree8d5db6c31705a5452170932cb082a08a181445e4 /include
parent71598f4f3a9cdd354b768c49e705a24288a6ff51 (diff)
downloadSTC-modified-835a3a974f4f79ca789d6fca6c9745b4f4931870.tar.gz
STC-modified-835a3a974f4f79ca789d6fca6c9745b4f4931870.zip
Added carr_X_idx().
Diffstat (limited to 'include')
-rw-r--r--include/stc/carr2.h4
-rw-r--r--include/stc/carr3.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/include/stc/carr2.h b/include/stc/carr2.h
index b961c47e..cda5a3b0 100644
--- a/include/stc/carr2.h
+++ b/include/stc/carr2.h
@@ -81,6 +81,10 @@ STC_INLINE const _cx_value *_cx_memb(_at)(const _cx_self* self, size_t x, size_t
return *self->data + self->ydim*x + y;
}
+STC_INLINE size_t _cx_memb(_idx)(const _cx_self* self, size_t x, size_t y) {
+ return self->ydim*x + y;
+}
+
STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) {
if (self->data == other.data) return;
_cx_memb(_del)(self); *self = _cx_memb(_clone)(other);
diff --git a/include/stc/carr3.h b/include/stc/carr3.h
index 3f230204..d8c79c64 100644
--- a/include/stc/carr3.h
+++ b/include/stc/carr3.h
@@ -83,6 +83,10 @@ STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t x, size_t
return **self->data + self->zdim*(self->ydim*x + y) + z;
}
+STC_INLINE size_t _cx_memb(_idx)(const _cx_self* self, size_t x, size_t y, size_t z) {
+ return 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;
_cx_memb(_del)(self); *self = _cx_memb(_clone)(other);