From ec642ecf6d94f11d5eb05ab1fb7a9728c9a89cae Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <pere@debian.org>
Date: Sun, 9 Mar 2025 22:53:57 +0100
Subject: [PATCH] Replaced more possible bit shifting into signed bit of stride
 values.

Leftover changes from a6766c94721bc55e8e56fb0d941ecfe2d27c3d17.

Use multiplication instead, allowing the compiler to optimize to
bitshifts if it believe it to be safe.

Partly solves github issue #18.
---
 lib/c64x/c64xfrag.c   | 2 +-
 lib/x86/mmxstate.c    | 4 ++--
 lib/x86_vc/mmxstate.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/c64x/c64xfrag.c b/lib/c64x/c64xfrag.c
index 140357e2..01e6e23a 100644
--- a/lib/c64x/c64xfrag.c
+++ b/lib/c64x/c64xfrag.c
@@ -436,7 +436,7 @@ void oc_state_loop_filter_frag_rows_c64x(const oc_theora_state *_state,
           loop_filter_h(ref+8,ystride,ll);
         }
         if(fragi+nhfrags<fragi_bot&&!frags[fragi+nhfrags].coded){
-          loop_filter_v(ref+(ystride<<3),ystride,ll);
+          loop_filter_v(ref+(ystride*8),ystride,ll);
         }
       }
       fragi++;
diff --git a/lib/x86/mmxstate.c b/lib/x86/mmxstate.c
index 2572773e..e1bf61c1 100644
--- a/lib/x86/mmxstate.c
+++ b/lib/x86/mmxstate.c
@@ -146,7 +146,7 @@ void oc_state_loop_filter_frag_rows_mmx(const oc_theora_state *_state,
           OC_LOOP_FILTER_H(OC_LOOP_FILTER8_MMX,ref+8,ystride,ll);
         }
         if(fragi+nhfrags<fragi_bot&&!frags[fragi+nhfrags].coded){
-          OC_LOOP_FILTER_V(OC_LOOP_FILTER8_MMX,ref+(ystride<<3),ystride,ll);
+          OC_LOOP_FILTER_V(OC_LOOP_FILTER8_MMX,ref+(ystride*8),ystride,ll);
         }
       }
       fragi++;
@@ -213,7 +213,7 @@ void oc_state_loop_filter_frag_rows_mmxext(const oc_theora_state *_state,
           OC_LOOP_FILTER_H(OC_LOOP_FILTER8_MMXEXT,ref+8,ystride,_bv);
         }
         if(fragi+nhfrags<fragi_bot&&!frags[fragi+nhfrags].coded){
-          OC_LOOP_FILTER_V(OC_LOOP_FILTER8_MMXEXT,ref+(ystride<<3),ystride,_bv);
+          OC_LOOP_FILTER_V(OC_LOOP_FILTER8_MMXEXT,ref+(ystride*8),ystride,_bv);
         }
       }
       fragi++;
diff --git a/lib/x86_vc/mmxstate.c b/lib/x86_vc/mmxstate.c
index 38fbbba4..f10f89e8 100644
--- a/lib/x86_vc/mmxstate.c
+++ b/lib/x86_vc/mmxstate.c
@@ -157,7 +157,7 @@ void oc_state_loop_filter_frag_rows_mmx(const oc_theora_state *_state,
           OC_LOOP_FILTER_H_MMX(ref+8,ystride,_bv);
         }
         if(fragi+nhfrags<fragi_bot&&!frags[fragi+nhfrags].coded){
-          OC_LOOP_FILTER_V_MMX(ref+(ystride<<3),ystride,_bv);
+          OC_LOOP_FILTER_V_MMX(ref+(ystride*8),ystride,_bv);
         }
 #undef PIX
 #undef YSTRIDE3
-- 
GitLab