Merge "Fix SATURATE_LEFT_SHIFT_ALT() since it returned 0x80000000 in certain cases"

This commit is contained in:
Jean-Michel Trivi 2018-12-27 00:55:34 +00:00 committed by Gerrit Code Review
commit 27894057af
1 changed files with 5 additions and 5 deletions

View File

@ -271,7 +271,7 @@ inline void scaleValueInPlace(FIXP_DBL *value, /*!< Value */
#define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \ #define SATURATE_LEFT_SHIFT_ALT(src, scale, dBits) \
(((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \ (((LONG)(src) > ((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \
? (LONG)(((1U) << ((dBits)-1)) - 1) \ ? (LONG)(((1U) << ((dBits)-1)) - 1) \
: ((LONG)(src) < ~((LONG)(((1U) << ((dBits)-1)) - 2) >> (scale))) \ : ((LONG)(src) <= ~((LONG)(((1U) << ((dBits)-1)) - 1) >> (scale))) \
? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \ ? ~((LONG)(((1U) << ((dBits)-1)) - 2)) \
: ((LONG)(src) << (scale))) : ((LONG)(src) << (scale)))
#endif #endif