diff options
author | Chris Robinson <[email protected]> | 2014-03-08 22:34:07 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-08 22:34:07 -0800 |
commit | 14a04020ff6aa9c5314b2695583029fce5f04a1c (patch) | |
tree | 6e1212e15b167981da230eca69ce3c2890ec47d3 | |
parent | 2e279684d726f597b4040e17381784e3dbc890ea (diff) |
Improve int-to-float and uint-to-float conversions
-rw-r--r-- | OpenAL32/sample_cvt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/OpenAL32/sample_cvt.c b/OpenAL32/sample_cvt.c index 0c0ba6dd..a276d454 100644 --- a/OpenAL32/sample_cvt.c +++ b/OpenAL32/sample_cvt.c @@ -748,9 +748,9 @@ static inline ALfloat Conv_ALfloat_ALshort(ALshort val) static inline ALfloat Conv_ALfloat_ALushort(ALushort val) { return (val-32768) * (1.0f/32767.0f); } static inline ALfloat Conv_ALfloat_ALint(ALint val) -{ return (ALfloat)(val * (1.0/2147483647.0)); } +{ return (ALfloat)(val>>7) * (1.0f/16777215.0f); } static inline ALfloat Conv_ALfloat_ALuint(ALuint val) -{ return (ALfloat)((ALint)(val-2147483648u) * (1.0/2147483647.0)); } +{ return (ALfloat)((ALint)(val>>7)-16777216) * (1.0f/16777215.0f); } static inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) { return (val==val) ? val : 0.0f; } static inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) |