From c231637529ce7fc5b321c24a24320b505df51e91 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 23 May 2024 13:54:10 +0200 Subject: Better naming in C code --- cbits/arith.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cbits') diff --git a/cbits/arith.c b/cbits/arith.c index ca16bf8..3c5d846 100644 --- a/cbits/arith.c +++ b/cbits/arith.c @@ -37,7 +37,9 @@ typedef int64_t i64; // This does not result in multiple loads with GCC 13. #define GEN_SIGNUM(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0) -#define TARRAY_WALK(again_label_name, rank, shape, strides, body) \ +// Walk a orthotope-style strided array, except for the inner dimension. The +// body is run for every "inner vector". +#define TARRAY_WALK_NOINNER(again_label_name, rank, shape, strides, body) \ do { \ i64 idx[(rank) - 1]; \ memset(idx, 0, ((rank) - 1) * sizeof(idx[0])); \ @@ -68,7 +70,7 @@ typedef int64_t i64; #define REDUCE1_OP(name, op, typ) \ void oxarop_ ## name ## _ ## typ(i64 rank, const i64 *shape, const i64 *strides, typ *out, const typ *arr) { \ if (strides[rank - 1] == 1) { \ - TARRAY_WALK(again1, rank, shape, strides, { \ + TARRAY_WALK_NOINNER(again1, rank, shape, strides, { \ typ accum = arr[arrlinidx]; \ for (i64 i = 1; i < shape[rank - 1]; i++) { \ accum = accum op arr[arrlinidx + i]; \ @@ -76,7 +78,7 @@ typedef int64_t i64; out[outlinidx] = accum; \ }); \ } else { \ - TARRAY_WALK(again2, rank, shape, strides, { \ + TARRAY_WALK_NOINNER(again2, rank, shape, strides, { \ typ accum = arr[arrlinidx]; \ for (i64 i = 1; i < shape[rank - 1]; i++) { \ accum = accum op arr[arrlinidx + strides[rank - 1] * i]; \ -- cgit v1.2.3-70-g09d2