From 5f764285241a6eced0599c33c66253607b4ffefc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 24 Mar 2008 14:00:59 +0100 Subject: [PATCH] Simplify XNORM() and YNORM() Simplify (M - (n % M)) % M to M - (n % M), for n < 0. --- include/xy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xy.h b/include/xy.h index b427ee2af..9f1f06c21 100644 --- a/include/xy.h +++ b/include/xy.h @@ -43,9 +43,9 @@ #define XYOFFSET(x, y) (((y) * WORLD_X + (x)) / 2) #define XNORM(x) \ - (((x) < 0) ? ((WORLD_X - (-(x) % WORLD_X)) % WORLD_X) : ((x) % WORLD_X)) + (((x) < 0) ? (WORLD_X - (-(x) % WORLD_X)) : ((x) % WORLD_X)) #define YNORM(y) \ - (((y) < 0) ? ((WORLD_Y - (-(y) % WORLD_Y)) % WORLD_Y) : ((y) % WORLD_Y)) + (((y) < 0) ? (WORLD_Y - (-(y) % WORLD_Y)) : ((y) % WORLD_Y)) struct range { coord lx; /* low-range x,y */ -- 2.43.0