diff options
author | Chris Robinson <[email protected]> | 2010-11-21 03:58:37 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-21 03:58:37 -0800 |
commit | bbb45e326c049aef5b4d7e86021f365d206d8bb3 (patch) | |
tree | db78666349d7eca08652792854a987a218406e9a /Alc | |
parent | dfe3e402a8105a939913e3b67adf5e6a491ea66e (diff) |
Avoid temporary float variables
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index a3349993..092c01e2 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -45,12 +45,13 @@ static __inline ALfloat point32(ALfloat val1, ALfloat val2, ALint frac) } static __inline ALfloat lerp32(ALfloat val1, ALfloat val2, ALint frac) { - return val1 + ((val2-val1)*(frac * (1.0f/(1<<FRACTIONBITS)))); + val1 += ((val2-val1) * (frac * (1.0/(1<<FRACTIONBITS)))); + return val1; } static __inline ALfloat cos_lerp32(ALfloat val1, ALfloat val2, ALint frac) { - ALfloat mult = (1.0f-cos(frac * (1.0f/(1<<FRACTIONBITS)) * M_PI)) * 0.5f; - return val1 + ((val2-val1)*mult); + val1 += ((val2-val1) * ((1.0-cos(frac * (1.0/(1<<FRACTIONBITS)) * M_PI)) * 0.5)); + return val1; } static __inline ALfloat point16(ALfloat val1, ALfloat val2, ALint frac) @@ -61,13 +62,12 @@ static __inline ALfloat point16(ALfloat val1, ALfloat val2, ALint frac) } static __inline ALfloat lerp16(ALfloat val1, ALfloat val2, ALint frac) { - val1 += ((val2-val1)*(frac * (1.0f/(1<<FRACTIONBITS)))); + val1 += (val2-val1) * (frac * (1.0/(1<<FRACTIONBITS))); return val1 / 32767.0f; } static __inline ALfloat cos_lerp16(ALfloat val1, ALfloat val2, ALint frac) { - ALfloat mult = (1.0f-cos(frac * (1.0f/(1<<FRACTIONBITS)) * M_PI)) * 0.5f; - val1 += ((val2-val1)*mult); + val1 += (val2-val1) * ((1.0-cos(frac * (1.0/(1<<FRACTIONBITS)) * M_PI)) * 0.5); return val1 / 32767.0f; } |