changeset 2486:6d12670e0248

Rename DM_SWAP() macro to DM_SWAP_IF().
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Apr 2020 14:45:44 +0300
parents fce2ed3f681f
children 14a4f8d78fe6
files src/dmlib.h tools/libgutil.c
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmlib.h	Tue Apr 28 14:16:50 2020 +0300
+++ b/src/dmlib.h	Tue Apr 28 14:45:44 2020 +0300
@@ -273,7 +273,8 @@
 
 
 // Macro for swapping two lvalues of same type
-#define DM_SWAP(T, A, B) { if ((B) < (A)) { T swtmp = (B); B = (A); A = swtmp; } }
+#define DM_SWAP(T, A, B) { T swtmp = (B); B = (A); A = swtmp; }
+#define DM_SWAP_IF(T, A, B) { if ((B) < (A)) { T swtmp = (B); B = (A); A = swtmp; } }
 
 
 /* Drawing modes used by blitting and some other functions.
--- a/tools/libgutil.c	Tue Apr 28 14:16:50 2020 +0300
+++ b/tools/libgutil.c	Tue Apr 28 14:45:44 2020 +0300
@@ -26,7 +26,7 @@
               cx1 = screen->clip_rect.x + screen->clip_rect.w - 1,
               cy1 = screen->clip_rect.y + screen->clip_rect.h - 1;
 
-    DM_SWAP(int, x0, x1);
+    DM_SWAP_IF(int, x0, x1);
     if (yc < cy0|| yc > cy1 || x1 < cx0 || x0 > cx1) return;
     if (x0 < cx0) x0 = cx0;
     if (x1 > cx1) x1 = cx1;
@@ -59,7 +59,7 @@
               cx1 = screen->clip_rect.x + screen->clip_rect.w - 1,
               cy1 = screen->clip_rect.y + screen->clip_rect.h - 1;
 
-    DM_SWAP(int, y0, y1);
+    DM_SWAP_IF(int, y0, y1);
     if (xc < cx0 || xc > cx1 || y1 < cy0 || y0 > cy1) return;
     if (y0 < cy0) y0 = cy0;
     if (y1 > cy1) y1 = cy1;