diff options
author | Chris Robinson <[email protected]> | 2010-11-26 01:35:40 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-26 01:35:40 -0800 |
commit | d647ed60e8706b4696a9af771f9e2094a41937fb (patch) | |
tree | 6ef70d349df6c04664bcfe16424c38b9110794c8 | |
parent | 1cb29ece08cc6b43bb4b93e71d7139fc1cf8c919 (diff) |
Convert a few divisions to multiplications
-rw-r--r-- | Alc/mixer.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 9fae065e..2e7a92f3 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -46,20 +46,21 @@ static __inline ALdouble cubic32(const ALfloat *vals, ALint step, ALint frac) frac * (1.0/FRACTIONONE)); } static __inline ALdouble point16(const ALshort *vals, ALint step, ALint frac) -{ return vals[0] / 32767.0; (void)step; (void)frac; } +{ return vals[0] * (1.0/32767.0); (void)step; (void)frac; } static __inline ALdouble lerp16(const ALshort *vals, ALint step, ALint frac) -{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)) / 32767.0; } +{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)) * (1.0/32767.0); } static __inline ALdouble cubic16(const ALshort *vals, ALint step, ALint frac) { return cubic(vals[-step], vals[0], vals[step], vals[step+step], - frac * (1.0/FRACTIONONE)) / 32767.0; } + frac * (1.0/FRACTIONONE)) * (1.0/32767.0); } static __inline ALdouble point8(const ALubyte *vals, ALint step, ALint frac) -{ return (vals[0]-128.0) / 127.0; (void)step; (void)frac; } +{ return (vals[0]-128.0) * (1.0/127.0); (void)step; (void)frac; } static __inline ALdouble lerp8(const ALubyte *vals, ALint step, ALint frac) -{ return (lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE))-128.0) / 127.0; } +{ return (lerp(vals[0], vals[step], + frac * (1.0/FRACTIONONE))-128.0) * (1.0/127.0); } static __inline ALdouble cubic8(const ALubyte *vals, ALint step, ALint frac) { return (cubic(vals[-step], vals[0], vals[step], vals[step+step], - frac * (1.0/FRACTIONONE))-128.0) / 127.0; } + frac * (1.0/FRACTIONONE))-128.0) * (1.0/127.0); } #define DECL_TEMPLATE(T, sampler) \ |