diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2018-12-26 17:06:09 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-12-26 17:06:09 -0800 |
commit | 232d00017306ad6a8a3fe43487cf61c3e24e0e9b (patch) | |
tree | ac749121dfc55b0a1a55b0180ca8de59379d568a | |
parent | a8e50fd20e0a8242a38af41d98d694b32729960d (diff) | |
parent | 86d12efb927c91a4b8f6f995a023fb05958ae3e9 (diff) | |
download | fdk-aac-232d00017306ad6a8a3fe43487cf61c3e24e0e9b.tar.gz fdk-aac-232d00017306ad6a8a3fe43487cf61c3e24e0e9b.tar.bz2 fdk-aac-232d00017306ad6a8a3fe43487cf61c3e24e0e9b.zip |
Merge "Fix SATURATE_LEFT_SHIFT_ALT() since it returned 0x80000000 in certain cases" am: 27894057af
am: 86d12efb92
Change-Id: I61e1f526eccf8c6cdf428058ba7b1da4ae2f9a80
-rw-r--r-- | libFDK/include/scale.h | 10 |
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 |