summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cspan.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-06-11 14:03:16 +0200
committerTyge Løvset <[email protected]>2023-06-11 14:59:06 +0200
commitb564ef6bdfcd2437f1b4997f42054c45ccdedbb1 (patch)
treeb6c5458b8bc47279d18408f25e79eb6118808d78 /include/stc/cspan.h
parentf3529a2600141dc7f84c734ea3bf5db8f7090e56 (diff)
downloadSTC-modified-b564ef6bdfcd2437f1b4997f42054c45ccdedbb1.tar.gz
STC-modified-b564ef6bdfcd2437f1b4997f42054c45ccdedbb1.zip
Added priv/linkage.h and renamed priv/template2.h => priv/template_undef.h.
Make all examples c++ compatible, except those using cspan.h Removed: crange_obj() Renamed: crange_make() => crange_init() Renamed: cspan_make() => cspan_init() Renamed: cstr_NULL => cstr_null Renamed: csview_NULL => csview_null
Diffstat (limited to 'include/stc/cspan.h')
-rw-r--r--include/stc/cspan.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/stc/cspan.h b/include/stc/cspan.h
index dd6cb1c0..d7a72267 100644
--- a/include/stc/cspan.h
+++ b/include/stc/cspan.h
@@ -60,6 +60,7 @@ int demo2() {
#ifndef STC_CSPAN_H_INCLUDED
#define STC_CSPAN_H_INCLUDED
+#include "priv/linkage.h"
#include "ccommon.h"
#define using_cspan(...) c_MACRO_OVERLOAD(using_cspan, __VA_ARGS__)
@@ -80,7 +81,7 @@ int demo2() {
return (Self){.data=raw, .shape={(int32_t)n}}; \
} \
STC_INLINE Self Self##_slice_(Self##_value* v, const int32_t shape[], const int32_t stri[], \
- const int rank, const int32_t a[][2]) { \
+ const int rank, const int32_t a[][2]) { \
Self s = {.data=v}; int outrank; \
s.data += _cspan_slice(s.shape, s.stride.d, &outrank, shape, stri, rank, a); \
c_ASSERT(outrank == RANK); \
@@ -115,8 +116,8 @@ typedef struct { int32_t d[6]; } cspan_idx6;
#define cspan_md(array, ...) \
{.data=array, .shape={__VA_ARGS__}, .stride={.d={__VA_ARGS__}}}
-/* For static initialization, use cspan_make(). c_init() for non-static only. */
-#define cspan_make(SpanType, ...) \
+/* For static initialization, use cspan_init(). c_init() for non-static only. */
+#define cspan_init(SpanType, ...) \
{.data=(SpanType##_value[])__VA_ARGS__, .shape={sizeof((SpanType##_value[])__VA_ARGS__)/sizeof(SpanType##_value)}}
#define cspan_slice(OutSpan, parent, ...) \
@@ -210,6 +211,7 @@ STC_API intptr_t _cspan_next2(int rank, int32_t pos[], const int32_t shape[], co
STC_API intptr_t _cspan_slice(int32_t odim[], int32_t ostri[], int* orank,
const int32_t shape[], const int32_t stri[],
int rank, const int32_t a[][2]);
+#endif // STC_CSPAN_H_INCLUDED
/* -------------------------- IMPLEMENTATION ------------------------- */
#if defined(i_implement) || defined(i_static)
@@ -260,7 +262,6 @@ STC_DEF intptr_t _cspan_slice(int32_t odim[], int32_t ostri[], int* orank,
return off;
}
#endif
-#endif
#undef i_opt
#undef i_header
#undef i_implement