diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2018-12-27 00:55:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-12-27 00:55:34 +0000 |
commit | 27894057af917ea3f87206a609cb3e628e0069a5 (patch) | |
tree | 7e0930940c6f5a31b282179e8e8a08989ef6525d /libFDK | |
parent | f59fd73d4443b015b11a362c807f6b828658a799 (diff) | |
parent | edbb4b0a14f6ba252592a34cb95f2c9ace89b80e (diff) | |
download | fdk-aac-27894057af917ea3f87206a609cb3e628e0069a5.tar.gz fdk-aac-27894057af917ea3f87206a609cb3e628e0069a5.tar.bz2 fdk-aac-27894057af917ea3f87206a609cb3e628e0069a5.zip |
Merge "Fix SATURATE_LEFT_SHIFT_ALT() since it returned 0x80000000 in certain cases"
Diffstat (limited to 'libFDK')
-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 |