diff options
author | datenwolf <code+github@datenwolf.net> | 2015-01-25 13:14:22 +0100 |
---|---|---|
committer | datenwolf <code+github@datenwolf.net> | 2015-01-25 13:14:22 +0100 |
commit | cc811835476a7f230a2a348ce48b9ee07139b6dc (patch) | |
tree | 372bf08fa73227665a2dd27f28fa47af7e24d046 | |
parent | b1cd7f0a246d2061e994d3875de875359136a734 (diff) | |
parent | 1000e36d1bc4555f5fd2f65082399b437b9cf7c3 (diff) | |
download | linmath-cc811835476a7f230a2a348ce48b9ee07139b6dc.tar.gz linmath-cc811835476a7f230a2a348ce48b9ee07139b6dc.tar.xz linmath-cc811835476a7f230a2a348ce48b9ee07139b6dc.zip |
Merge pull request #17 from dv343/master
Warning removal
-rw-r--r-- | linmath.h | 18 |
1 files changed, 9 insertions, 9 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,19 +31,19 @@ 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); \ } -LINMATH_H_DEFINE_VEC(2); -LINMATH_H_DEFINE_VEC(3); -LINMATH_H_DEFINE_VEC(4); +LINMATH_H_DEFINE_VEC(2) +LINMATH_H_DEFINE_VEC(3) +LINMATH_H_DEFINE_VEC(4) static inline void vec3_mul_cross(vec3 r, vec3 const a, vec3 const b) { |