From e4c2701671a8439fc547ecabd919c1c207e92644 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 15 Feb 2022 19:35:30 +1100 Subject: [PATCH] neatogen: [nfc] remove some temporaries These seemed to be making the code less clear rather than more clear. --- lib/neatogen/matrix_ops.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/neatogen/matrix_ops.c b/lib/neatogen/matrix_ops.c index ad33e0dd0..e123c0184 100644 --- a/lib/neatogen/matrix_ops.c +++ b/lib/neatogen/matrix_ops.c @@ -599,10 +599,9 @@ void square_vec(int n, float *vec) void invert_vec(int n, float *vec) { int i; - float v; for (i = 0; i < n; i++) { - if ((v = vec[i]) != 0.0) - vec[i] = 1.0f / v; + if (vec[i] != 0.0) + vec[i] = 1.0f / vec[i]; } } @@ -617,10 +616,9 @@ void sqrt_vec(int n, float *vec) void sqrt_vecf(int n, float *source, float *target) { int i; - float v; for (i = 0; i < n; i++) { - if ((v = source[i]) >= 0.0) { - target[i] = sqrtf(v); + if (source[i] >= 0.0) { + target[i] = sqrtf(source[i]); } } } @@ -628,10 +626,9 @@ void sqrt_vecf(int n, float *source, float *target) void invert_sqrt_vec(int n, float *vec) { int i; - float v; for (i = 0; i < n; i++) { - if ((v = vec[i]) > 0.0) { - vec[i] = 1.0f / sqrtf(v); + if (vec[i] > 0.0) { + vec[i] = 1.0f / sqrtf(vec[i]); } } } -- 2.40.0