apedec: fix signed integer overflows
This bit manipulation is equivalent but avoids undefined shifts and overflows. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
93c286e54f
commit
644bff6c9b
@ -690,7 +690,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
|
||||
/* Update the adaption coefficients */
|
||||
absres = FFABS(res);
|
||||
if (absres)
|
||||
*f->adaptcoeffs = ((res & (1<<31)) - (1<<30)) >>
|
||||
*f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >>
|
||||
(25 + (absres <= f->avg*3) + (absres <= f->avg*4/3));
|
||||
else
|
||||
*f->adaptcoeffs = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user