diff options
author | RĂ©mi Denis-Courmont <remi@remlab.net> | 2022-09-15 21:26:48 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-09-15 18:11:12 -0300 |
commit | 6df3ad9687c41d17094ae5d16b4904f50338e0c4 (patch) | |
tree | deb7b380d32aa53ef7f16a3383e5b715e91b1279 | |
parent | a2c6bf2314472dde268d641b19f08487af356517 (diff) | |
download | ffmpeg-6df3ad9687c41d17094ae5d16b4904f50338e0c4.tar.gz |
lavu/riscv: fix off-by-one in bit-magnitude clip
-rw-r--r-- | libavutil/riscv/intmath.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h index 3263a79dc4..45bce9a0e7 100644 --- a/libavutil/riscv/intmath.h +++ b/libavutil/riscv/intmath.h @@ -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); |