diff options
| author | Tyge Lovset <[email protected]> | 2023-04-08 22:30:46 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-04-08 22:30:46 +0200 |
| commit | 6426ac05eb8c4dc1ab22aae2eb4139f9671981b7 (patch) | |
| tree | f3b9917940f94c1582bc39ea6f56b735295ec861 /include/stc | |
| parent | 2f64fae1f2f041ad3aec4a2388975297075fef42 (diff) | |
| download | STC-modified-6426ac05eb8c4dc1ab22aae2eb4139f9671981b7.tar.gz STC-modified-6426ac05eb8c4dc1ab22aae2eb4139f9671981b7.zip | |
Reverted c_arraylen(), removed c_ARRAYLEN()
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/ccommon.h | 3 | ||||
| -rw-r--r-- | include/stc/cspan.h | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 1a2b3c3f..d5508807 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -123,8 +123,7 @@ C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw)) #define c_litstrlen(literal) (c_sizeof("" literal) - 1) -#define c_arraylen(a) (c_ARRAYLEN(a) + c_static_assert(sizeof(a) != sizeof(uintptr_t))) -#define c_ARRAYLEN(a) (intptr_t)(sizeof(a)/sizeof 0[a]) +#define c_arraylen(a) (intptr_t)(sizeof(a)/sizeof 0[a]) // Non-owning c-string typedef const char* crawstr; diff --git a/include/stc/cspan.h b/include/stc/cspan.h index ce3c33ce..ac3e9206 100644 --- a/include/stc/cspan.h +++ b/include/stc/cspan.h @@ -129,10 +129,10 @@ typedef struct { int32_t d[6]; } cspan_idx6; {.data=(container)->data, .shape={(int32_t)(container)->_len}} #define cspan_from_array(array) \ - {.data=(array) + c_static_assert(sizeof(array) != sizeof(void*)), .shape={c_ARRAYLEN(array)}} + {.data=(array) + c_static_assert(sizeof(array) != sizeof(void*)), .shape={c_arraylen(array)}} #define cspan_size(self) _cspan_size((self)->shape, cspan_rank(self)) -#define cspan_rank(self) c_ARRAYLEN((self)->shape) +#define cspan_rank(self) c_arraylen((self)->shape) #define cspan_index(self, ...) c_PASTE(cspan_idx_, c_NUMARGS(__VA_ARGS__))(self, __VA_ARGS__) #define cspan_idx_1 cspan_idx_4 |
