diff options
author | Tim Malte Gräfje <Tim.Graefje@gmx.de> | 2015-01-08 18:18:33 +0100 |
---|---|---|
committer | Tim Malte Gräfje <Tim.Graefje@gmx.de> | 2015-01-08 18:18:33 +0100 |
commit | 9af0a9f58f42f7e129d02ef658fe6291b48fa037 (patch) | |
tree | 51ca5246db6563e4883158c447459c6781490564 | |
parent | b1cd7f0a246d2061e994d3875de875359136a734 (diff) | |
download | linmath-9af0a9f58f42f7e129d02ef658fe6291b48fa037.tar.gz linmath-9af0a9f58f42f7e129d02ef658fe6291b48fa037.tar.xz linmath-9af0a9f58f42f7e129d02ef658fe6291b48fa037.zip |
Made parameters of generic vector functions const
where applicable. This fixes all warnings that gcc with -Wall gave me.
-rw-r--r-- | linmath.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -5,25 +5,25 @@ #define LINMATH_H_DEFINE_VEC(n) \ typedef float vec##n[n]; \ -static inline void vec##n##_add(vec##n r, vec##n a, vec##n b) \ +static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \ { \ int i; \ for(i=0; i<n; ++i) \ r[i] = a[i] + b[i]; \ } \ -static inline void vec##n##_sub(vec##n r, vec##n a, vec##n b) \ +static inline void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \ { \ int i; \ for(i=0; i<n; ++i) \ r[i] = a[i] - b[i]; \ } \ -static inline void vec##n##_scale(vec##n r, vec##n v, float s) \ +static inline void vec##n##_scale(vec##n r, vec##n const v, float const s) \ { \ int i; \ for(i=0; i<n; ++i) \ r[i] = v[i] * s; \ } \ -static inline float vec##n##_mul_inner(vec##n a, vec##n b) \ +static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \ { \ float p = 0.; \ int i; \ @@ -31,11 +31,11 @@ static inline float vec##n##_mul_inner(vec##n a, vec##n b) \ p += b[i]*a[i]; \ return p; \ } \ -static inline float vec##n##_len(vec##n v) \ +static inline float vec##n##_len(vec##n const v) \ { \ return sqrtf(vec##n##_mul_inner(v,v)); \ } \ -static inline void vec##n##_norm(vec##n r, vec##n v) \ +static inline void vec##n##_norm(vec##n r, vec##n const v) \ { \ float k = 1.0 / vec##n##_len(v); \ vec##n##_scale(r, v, k); \ |