diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2024-05-24 21:29:04 +0200 | 
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-24 21:29:04 +0200 | 
| commit | d4e328cc5edb171501adc5e6abdfff6e45aace3e (patch) | |
| tree | a6200ca5339b65d17914bd807bf9f71e2c189835 | |
| parent | 7afc48ac656162972f780740c675d87d15b2fe1d (diff) | |
Add more const in C arith ops
| -rw-r--r-- | cbits/arith.c | 6 | 
1 files 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]); \    } | 
