From 6e299c3dcb81582d364357d18dd206448c0df859 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 15 Feb 2022 19:18:31 +1100 Subject: [PATCH] neatogen: replace float-casted calls to 'sqrt' with calls to 'sqrtf' This is simpler, more efficient, and clearer to the compiler. --- lib/neatogen/matrix_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/neatogen/matrix_ops.c b/lib/neatogen/matrix_ops.c index 85d8ab370..d13ced562 100644 --- a/lib/neatogen/matrix_ops.c +++ b/lib/neatogen/matrix_ops.c @@ -612,7 +612,7 @@ void sqrt_vec(int n, float *vec) { int i; for (i = 0; i < n; i++) { - vec[i] = (float) sqrt(vec[i]); + vec[i] = sqrtf(vec[i]); } } @@ -622,7 +622,7 @@ void sqrt_vecf(int n, float *source, float *target) float v; for (i = 0; i < n; i++) { if ((v = source[i]) >= 0.0) { - target[i] = (float) sqrt(v); + target[i] = sqrtf(v); } } } @@ -633,7 +633,7 @@ void invert_sqrt_vec(int n, float *vec) float v; for (i = 0; i < n; i++) { if ((v = vec[i]) > 0.0) { - vec[i] = 1.0f / (float) sqrt(v); + vec[i] = 1.0f / sqrtf(v); } } } -- 2.40.0