summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-08 12:18:59 +0100
committerTyge Løvset <[email protected]>2023-02-08 12:18:59 +0100
commit673dd5319a488d4b702b94dd9aeda4e497ae4fbc (patch)
tree03f3f96388ba1829eed3203ae8c7838a7110b0a1
parent1353117ffc5a26709b1a00995cc6be49e1eab7ab (diff)
downloadSTC-modified-673dd5319a488d4b702b94dd9aeda4e497ae4fbc.tar.gz
STC-modified-673dd5319a488d4b702b94dd9aeda4e497ae4fbc.zip
Minors.
-rw-r--r--include/stc/cspan.h12
-rw-r--r--misc/examples/list.c4
2 files changed, 6 insertions, 10 deletions
diff --git a/include/stc/cspan.h b/include/stc/cspan.h
index 6c7bb273..62de174a 100644
--- a/include/stc/cspan.h
+++ b/include/stc/cspan.h
@@ -211,13 +211,12 @@ STC_API intptr_t _cspan_slice(int32_t odim[], int32_t ostri[], int* orank,
STC_DEF intptr_t _cspan_idxN(int rank, const int32_t shape[], const int32_t stri[], const int32_t a[]) {
intptr_t off = a[0];
- bool ok = c_LTu(a[0], shape[0]);
+ c_ASSERT(c_LTu(a[0], shape[0]));
for (int i = 1; i < rank; ++i) {
off *= stri[i];
off += a[i];
- ok &= c_LTu(a[i], shape[i]);
+ c_ASSERT(c_LTu(a[i], shape[i]));
}
- c_ASSERT(ok);
return off;
}
@@ -237,23 +236,22 @@ STC_DEF 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]) {
intptr_t off = 0;
- int i = 0, j = 0, ok = true;
+ int i = 0, j = 0;
int32_t t, s = 1;
for (; i < rank; ++i) {
off *= stri[i];
off += a[i][0];
switch (a[i][1]) {
- case 0: s *= stri[i]; ok &= c_LTu(a[i][0], shape[i]); continue;
+ case 0: s *= stri[i]; c_ASSERT(c_LTu(a[i][0], shape[i])); continue;
case -1: t = shape[i]; break;
default: t = a[i][1]; break;
}
odim[j] = t - a[i][0];
ostri[j] = s*stri[i];
- ok &= c_LTu(0, odim[j]) & !c_LTu(shape[i], t);
+ c_ASSERT(c_LTu(0, odim[j]) & !c_LTu(shape[i], t));
s = 1; ++j;
}
*orank = j;
- c_ASSERT(ok);
return off;
}
#endif
diff --git a/misc/examples/list.c b/misc/examples/list.c
index 4aacfe38..ced0be32 100644
--- a/misc/examples/list.c
+++ b/misc/examples/list.c
@@ -1,11 +1,9 @@
#include <stdio.h>
#include <time.h>
-#define STC_IMPLEMENT
-#define STC_EXTERN
-
#define i_val double
#define i_tag fx
+#define i_extern // include sort function
#include <stc/clist.h>
#include <stc/crandom.h>