Merge commit 'f3fdef108eb06b1e71b29152bf6822519e787efe'

* commit 'f3fdef108eb06b1e71b29152bf6822519e787efe':
  ape: Avoid undefined behaviour

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
Derek Buitenhuis 2016-05-12 14:20:51 +01:00
commit 22900770c5

View File

@ -1284,7 +1284,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
/* Update the adaption coefficients */
absres = FFABS(res);
if (absres)
*f->adaptcoeffs = ((res & INT32_MIN) ^ (-(1<<30))) >>
*f->adaptcoeffs = ((res & INT32_MIN) ^ ((~0UL) << 30)) >>
(25 + (absres <= f->avg*3) + (absres <= f->avg*4/3));
else
*f->adaptcoeffs = 0;