diff mbox series

[FFmpeg-devel,1/1] lavu/riscv: fix av_clip_int16

Message ID 20220914173419.161277-1-remi@remlab.net
State Accepted
Commit a5ce44f30108a0683a123354e52210a20026fb5c
Headers show
Series [FFmpeg-devel,1/1] lavu/riscv: fix av_clip_int16 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Rémi Denis-Courmont Sept. 14, 2022, 5:34 p.m. UTC
From: Rémi Denis-Courmont <remi@remlab.net>

Some serious copy-paste / squash / rebase mismanipulation here.
---
 libavutil/riscv/intmath.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

James Almer Sept. 14, 2022, 5:38 p.m. UTC | #1
On 9/14/2022 2:34 PM, remi@remlab.net wrote:
> From: Rémi Denis-Courmont <remi@remlab.net>
> 
> Some serious copy-paste / squash / rebase mismanipulation here.
> ---
>   libavutil/riscv/intmath.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h
> index 78f7ba930a..3263a79dc4 100644
> --- a/libavutil/riscv/intmath.h
> +++ b/libavutil/riscv/intmath.h
> @@ -41,10 +41,10 @@ static av_always_inline av_const int8_t av_clip_int8_rvi(int a)
>   #define av_clip_int16 av_clip_int16_rvi
>   static av_always_inline av_const int16_t av_clip_int16_rvi(int a)
>   {
> -    union { uint8_t u; int8_t s; } u = { .u = a };
> +    union { uint16_t u; int16_t s; } u = { .u = a };
>   
>       if (a != u.s)
> -        a = ((a >> 31) ^ 0x7F);
> +        a = ((a >> 31) ^ 0x7FFF);
>       return a;
>   }

Applied.
diff mbox series

Patch

diff --git a/libavutil/riscv/intmath.h b/libavutil/riscv/intmath.h
index 78f7ba930a..3263a79dc4 100644
--- a/libavutil/riscv/intmath.h
+++ b/libavutil/riscv/intmath.h
@@ -41,10 +41,10 @@  static av_always_inline av_const int8_t av_clip_int8_rvi(int a)
 #define av_clip_int16 av_clip_int16_rvi
 static av_always_inline av_const int16_t av_clip_int16_rvi(int a)
 {
-    union { uint8_t u; int8_t s; } u = { .u = a };
+    union { uint16_t u; int16_t s; } u = { .u = a };
 
     if (a != u.s)
-        a = ((a >> 31) ^ 0x7F);
+        a = ((a >> 31) ^ 0x7FFF);
     return a;
 }