Merge pull request #1096 from devnexen/unroll_dis

VectorLength reduces complexity.
This commit is contained in:
Yamagi 2024-04-01 09:07:59 +02:00 committed by GitHub
commit aa259a5d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -577,19 +577,9 @@ double sqrt(double x);
vec_t vec_t
VectorLength(vec3_t v) VectorLength(vec3_t v)
{ {
int i; return sqrtf((v[0] * v[0]) +
float length; (v[1] * v[1]) +
(v[2] * v[2]));
length = 0;
for (i = 0; i < 3; i++)
{
length += v[i] * v[i];
}
length = (float)sqrt(length);
return length;
} }
void void