提交 644bff6c 编写于 作者: M Mans Rullgard

apedec: fix signed integer overflows

This bit manipulation is equivalent but avoids undefined
shifts and overflows.
Signed-off-by: NMans Rullgard <mans@mansr.com>
上级 93c286e5
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册