aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK/include
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-12-26 17:02:06 -0800
committerandroid-build-merger <android-build-merger@google.com>2018-12-26 17:02:06 -0800
commit86d12efb927c91a4b8f6f995a023fb05958ae3e9 (patch)
tree7e0930940c6f5a31b282179e8e8a08989ef6525d /libFDK/include
parent24f0dd93fe06542339b2d6540efdea0c74e4ba43 (diff)
parent27894057af917ea3f87206a609cb3e628e0069a5 (diff)
downloadfdk-aac-86d12efb927c91a4b8f6f995a023fb05958ae3e9.tar.gz
fdk-aac-86d12efb927c91a4b8f6f995a023fb05958ae3e9.tar.bz2
fdk-aac-86d12efb927c91a4b8f6f995a023fb05958ae3e9.zip
Merge "Fix SATURATE_LEFT_SHIFT_ALT() since it returned 0x80000000 in certain cases"
am: 27894057af Change-Id: I8b0c317c7eac2ad8590a4c640414c20de448153b
Diffstat (limited to 'libFDK/include')
-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