diff options
author | Juha Riihim?ki <juha.riihimaki@nokia.com> | 2011-05-31 19:40:21 +0100 |
---|---|---|
committer | malc <av1474@comtv.ru> | 2011-06-01 00:14:07 +0400 |
commit | 05df9676b792a0cbe341b73578555db5b6fcdde6 (patch) | |
tree | ea68cab307d6f7adc55c50f897d1c86c3efd398b | |
parent | 497a2321d8367b77a995f32ace38ff4d74bf7e28 (diff) | |
download | qemu-05df9676b792a0cbe341b73578555db5b6fcdde6.tar.gz qemu-05df9676b792a0cbe341b73578555db5b6fcdde6.tar.bz2 qemu-05df9676b792a0cbe341b73578555db5b6fcdde6.zip |
audio: fix integer overflow expression
Fix an integer overflow that can happen for signed 32 bit types
when using FLOAT_MIXENG. (Note that at the moment this is only true
when using the MacOSX coreaudio audio driver.)
Signed-off-by: Juha Riihim?ki <juha.riihimaki@nokia.com>
[Peter Maydell: Removed unnecessary casts]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: malc <av1474@comtv.ru>
-rw-r--r-- | audio/mixeng_template.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index a2d0ef84fd..e644c231ad 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -46,7 +46,7 @@ static mixeng_real inline glue (conv_, ET) (IN_T v) #endif #else /* !RECIPROCAL */ #ifdef SIGNED - return nv / (mixeng_real) (IN_MAX - IN_MIN); + return nv / (mixeng_real) ((mixeng_real) IN_MAX - IN_MIN); #else return (nv - HALF) / (mixeng_real) IN_MAX; #endif @@ -63,7 +63,7 @@ static IN_T inline glue (clip_, ET) (mixeng_real v) } #ifdef SIGNED - return ENDIAN_CONVERT ((IN_T) (v * (IN_MAX - IN_MIN))); + return ENDIAN_CONVERT ((IN_T) (v * ((mixeng_real) IN_MAX - IN_MIN))); #else return ENDIAN_CONVERT ((IN_T) ((v * IN_MAX) + HALF)); #endif |