From d4e328cc5edb171501adc5e6abdfff6e45aace3e Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 24 May 2024 21:29:04 +0200 Subject: Add more const in C arith ops --- cbits/arith.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cbits/arith.c b/cbits/arith.c index 3c5d846..002910c 100644 --- a/cbits/arith.c +++ b/cbits/arith.c @@ -8,7 +8,7 @@ typedef int32_t i32; typedef int64_t i64; #define COMM_OP(name, op, typ) \ - void oxarop_ ## name ## _ ## typ ## _sv(i64 n, typ *out, typ x, typ *y) { \ + void oxarop_ ## name ## _ ## typ ## _sv(i64 n, typ *out, typ x, const typ *y) { \ for (i64 i = 0; i < n; i++) out[i] = x op y[i]; \ } \ void oxarop_ ## name ## _ ## typ ## _vv(i64 n, typ *out, const typ *x, const typ *y) { \ @@ -17,12 +17,12 @@ typedef int64_t i64; #define NONCOMM_OP(name, op, typ) \ COMM_OP(name, op, typ) \ - void oxarop_ ## name ## _ ## typ ## _vs(i64 n, typ *out, typ *x, typ y) { \ + void oxarop_ ## name ## _ ## typ ## _vs(i64 n, typ *out, const typ *x, typ y) { \ for (i64 i = 0; i < n; i++) out[i] = x[i] op y; \ } #define UNARY_OP(name, op, typ) \ - void oxarop_ ## name ## _ ## typ(i64 n, typ *out, typ *x) { \ + void oxarop_ ## name ## _ ## typ(i64 n, typ *out, const typ *x) { \ for (i64 i = 0; i < n; i++) out[i] = op(x[i]); \ } -- cgit v1.2.3-70-g09d2