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];
}
}
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]);
}
}
}
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]);
}
}
}