aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alu.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 289614de..0540c699 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -281,15 +281,13 @@ static __inline ALfloat aluDotproduct(const ALfloat *inVector1, const ALfloat *i
static __inline void aluNormalize(ALfloat *inVector)
{
- ALfloat length, inverse_length;
-
- length = aluSqrt(aluDotproduct(inVector, inVector));
- if(length > 0.0f)
+ ALfloat lengthsqr = aluDotproduct(inVector, inVector);
+ if(lengthsqr > 0.0f)
{
- inverse_length = 1.0f/length;
- inVector[0] *= inverse_length;
- inVector[1] *= inverse_length;
- inVector[2] *= inverse_length;
+ ALfloat inv_length = 1.0f/aluSqrt(lengthsqr);
+ inVector[0] *= inv_length;
+ inVector[1] *= inv_length;
+ inVector[2] *= inv_length;
}
}