aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-06-29 16:31:23 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2018-12-26 18:17:27 -0500
commitedbb4b0a14f6ba252592a34cb95f2c9ace89b80e (patch)
tree7e0930940c6f5a31b282179e8e8a08989ef6525d /libFDK
parentf59fd73d4443b015b11a362c807f6b828658a799 (diff)
downloadfdk-aac-edbb4b0a14f6ba252592a34cb95f2c9ace89b80e.tar.gz
fdk-aac-edbb4b0a14f6ba252592a34cb95f2c9ace89b80e.tar.bz2
fdk-aac-edbb4b0a14f6ba252592a34cb95f2c9ace89b80e.zip
Fix SATURATE_LEFT_SHIFT_ALT() since it returned 0x80000000 in certain cases
Bug: 112661911 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I16e522c975ad45ff8d47d4cabe44f1f2bf95b73b
Diffstat (limited to 'libFDK')
-rw-r--r--libFDK/include/scale.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libFDK/include/scale.h b/libFDK/include/scale.h
index 07bd3af..30fa089 100644
--- a/libFDK/include/scale.h
+++ b/libFDK/include/scale.h
@@ -268,11 +268,11 @@ inline void scaleValueInPlace(FIXP_DBL *value, /*!< Value */
* to avoid problems when inverting the sign of the result.
*/
#ifndef SATURATE_LEFT_SHIFT_ALT
-#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \
- (((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \
- ? (LONG)(((1U) << ((dBits)-1)) - 1) \
- : ((LONG)(src) < ~((LONG)(((1U) << ((dBits)-1)) - 2) >> (scale))) \
- ? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \
+#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \
+ (((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \
+ ? (LONG)(((1U) << ((dBits)-1)) - 1) \
+ : ((LONG)(src) <= ~((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \
+ ? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \
: ((LONG)(src) << (scale)))
#endif