Fix implicit double-to-float in linmath.h

This commit is contained in:
Camilla Löwy 2021-03-21 16:01:45 +01:00
parent 33cd8b865d
commit 9416a43404

16
deps/linmath.h vendored
View File

@ -5,6 +5,10 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
/* 2021-03-21 Camilla Löwy <elmindreda@elmindreda.org>
* - Replaced double constants with float equivalents
*/
#ifdef LINMATH_NO_INLINE #ifdef LINMATH_NO_INLINE
#define LINMATH_H_FUNC static #define LINMATH_H_FUNC static
#else #else
@ -575,17 +579,17 @@ LINMATH_H_FUNC void mat4x4_arcball(mat4x4 R, mat4x4 const M, vec2 const _a, vec2
vec2 a; memcpy(a, _a, sizeof(a)); vec2 a; memcpy(a, _a, sizeof(a));
vec2 b; memcpy(b, _b, sizeof(b)); vec2 b; memcpy(b, _b, sizeof(b));
float z_a = 0.; float z_a = 0.f;
float z_b = 0.; float z_b = 0.f;
if(vec2_len(a) < 1.) { if(vec2_len(a) < 1.f) {
z_a = sqrtf(1. - vec2_mul_inner(a, a)); z_a = sqrtf(1.f - vec2_mul_inner(a, a));
} else { } else {
vec2_norm(a, a); vec2_norm(a, a);
} }
if(vec2_len(b) < 1.) { if(vec2_len(b) < 1.f) {
z_b = sqrtf(1. - vec2_mul_inner(b, b)); z_b = sqrtf(1.f - vec2_mul_inner(b, b));
} else { } else {
vec2_norm(b, b); vec2_norm(b, b);
} }