From a9e5b5e5033524e81129ce5e6ae1ba8da3aff59f Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Fri, 23 Oct 2026 21:48:56 +0300
Subject: [PATCH 89/89] sdl: Drop unused DUFFS_LOOP_QUATRO2()

See RM #2404

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-sdl2/graphics.h | 48 +-------------------------------------
 client/gui-sdl3/graphics.h | 48 +-------------------------------------
 2 files changed, 2 insertions(+), 94 deletions(-)

diff --git a/client/gui-sdl2/graphics.h b/client/gui-sdl2/graphics.h
index 56d4ed6313..a302f5ccbd 100644
--- a/client/gui-sdl2/graphics.h
+++ b/client/gui-sdl2/graphics.h
@@ -45,7 +45,7 @@
 #define RECT_LIMIT  80
 
 /* DUFFS LOOPs come from SDL lib (LGPL) */
-/* DUFFS_LOOP_DOUBLE2 and DUFFS_LOOP_QUATRO2 was created by Rafal Bursig under GPL */
+/* DUFFS_LOOP_DOUBLE2 was created by Rafal Bursig under GPL */
 
 /* This is a very useful loop for optimizing blitters */
 #if defined(_MSC_VER) && (_MSC_VER == 1300)
@@ -113,33 +113,6 @@
 	}								\
 }
 
-/* 2 - times unrolled loop 4 pixels */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n, w = width;							\
-        if (w & 1) {							\
-	  pixel_copy_increment;						\
-	  w--;								\
-	}								\
-	if (w & 2) {							\
-	  double_pixel_copy_increment;					\
-	  w -= 2;							\
-	}								\
-	if ( w > 0 ) {							\
-	    n = ( w + 7 ) / 8;						\
-	    switch ( w & 4 ) {						\
-	    case 0: do {	quatro_pixel_copy_increment;		\
-	    case 4:		quatro_pixel_copy_increment;		\
-		    } while ( --n > 0 );				\
-	    }								\
-	}								\
-}
-
-/* Use the 8-times version of the loop by default */
-#define DUFFS_LOOP(pixel_copy_increment, width)				\
-	DUFFS_LOOP8(pixel_copy_increment, width)
-
 #else
 
 /* Don't use Duff's device to unroll loops */
@@ -156,25 +129,6 @@
     }									\
 }
 
-/* Don't use Duff's device to unroll loops */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n = width;							\
-        if (n & 1) {							\
-	  pixel_copy_increment;						\
-	  n--;								\
-	}								\
-	if (n & 2) {							\
-	  double_pixel_copy_increment;					\
-	  n -= 2;							\
-	}								\
-	for (; n > 0; --n) {   						\
-	  quatro_pixel_copy_increment;					\
-	  n -= 3;							\
-        }								\
-}
-
 /* Don't use Duff's device to unroll loops */
 #define DUFFS_LOOP(pixel_copy_increment, width)				\
 { int n;								\
diff --git a/client/gui-sdl3/graphics.h b/client/gui-sdl3/graphics.h
index ec9c52dc7d..924da670fe 100644
--- a/client/gui-sdl3/graphics.h
+++ b/client/gui-sdl3/graphics.h
@@ -37,7 +37,7 @@
 #define RECT_LIMIT  80
 
 /* DUFFS LOOPs come from SDL lib (LGPL) */
-/* DUFFS_LOOP_DOUBLE2 and DUFFS_LOOP_QUATRO2 was created by Rafal Bursig under GPL */
+/* DUFFS_LOOP_DOUBLE2 was created by Rafal Bursig under GPL */
 
 /* This is a very useful loop for optimizing blitters */
 #if defined(_MSC_VER) && (_MSC_VER == 1300)
@@ -105,33 +105,6 @@
 	}								\
 }
 
-/* 2 - times unrolled loop 4 pixels */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n, w = width;							\
-        if (w & 1) {							\
-	  pixel_copy_increment;						\
-	  w--;								\
-	}								\
-	if (w & 2) {							\
-	  double_pixel_copy_increment;					\
-	  w -= 2;							\
-	}								\
-	if ( w > 0 ) {							\
-	    n = ( w + 7 ) / 8;						\
-	    switch ( w & 4 ) {						\
-	    case 0: do {	quatro_pixel_copy_increment;		\
-	    case 4:		quatro_pixel_copy_increment;		\
-		    } while ( --n > 0 );				\
-	    }								\
-	}								\
-}
-
-/* Use the 8-times version of the loop by default */
-#define DUFFS_LOOP(pixel_copy_increment, width)				\
-	DUFFS_LOOP8(pixel_copy_increment, width)
-
 #else
 
 /* Don't use Duff's device to unroll loops */
@@ -148,25 +121,6 @@
     }									\
 }
 
-/* Don't use Duff's device to unroll loops */
-#define DUFFS_LOOP_QUATRO2(pixel_copy_increment,			\
-				double_pixel_copy_increment,		\
-				quatro_pixel_copy_increment, width)	\
-{ int n = width;							\
-        if (n & 1) {							\
-	  pixel_copy_increment;						\
-	  n--;								\
-	}								\
-	if (n & 2) {							\
-	  double_pixel_copy_increment;					\
-	  n -= 2;							\
-	}								\
-	for (; n > 0; --n) {   						\
-	  quatro_pixel_copy_increment;					\
-	  n -= 3;							\
-        }								\
-}
-
 /* Don't use Duff's device to unroll loops */
 #define DUFFS_LOOP(pixel_copy_increment, width)				\
 { int n;								\
-- 
2.53.0

