lavu/riscv: fix off-by-one in bit-magnitude clip

This commit is contained in:
Rémi Denis-Courmont 2022-09-15 21:26:48 +03:00 committed by James Almer
parent a2c6bf2314
commit 6df3ad9687
1 changed files with 2 additions and 2 deletions

View File

@ -61,8 +61,8 @@ static av_always_inline av_const int32_t av_clipl_int32_rvi(int64_t a)
#define av_clip_intp2 av_clip_intp2_rvi
static av_always_inline av_const int av_clip_intp2_rvi(int a, int p)
{
const int shift = 32 - p;
int b = (a << shift) >> shift;
const int shift = 31 - p;
int b = ((int)(((unsigned)a) << shift)) >> shift;
if (a != b)
b = (a >> 31) ^ ((1 << p) - 1);