From e264be1a78e0b919142923244dafddd6cb290447 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 17 Apr 2006 12:51:23 +0000 Subject: [PATCH] (XYOFFSET): Parenthesize macro parameters in expansion. --- include/xy.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/xy.h b/include/xy.h index e325c46f9..5cf59dbc6 100644 --- a/include/xy.h +++ b/include/xy.h @@ -39,10 +39,12 @@ /* Used to calculate an offset into an array. Used for dynamically sizing the world. */ -#define XYOFFSET(x, y) ((y * WORLD_X) + x) +#define XYOFFSET(x, y) (((y) * WORLD_X) + (x)) -#define XNORM(x) (((x)<0) ? ((WORLD_X-(-(x)%WORLD_X))%WORLD_X) : ((x)%WORLD_X)) -#define YNORM(y) (((y)<0) ? ((WORLD_Y-(-(y)%WORLD_Y))%WORLD_Y) : ((y)%WORLD_Y)) +#define XNORM(x) \ + (((x) < 0) ? ((WORLD_X - (-(x) % WORLD_X)) % WORLD_X) : ((x) % WORLD_X)) +#define YNORM(y) \ + (((y) < 0) ? ((WORLD_Y - (-(y) % WORLD_Y)) % WORLD_Y) : ((y) % WORLD_Y)) struct range { coord lx; /* low-range x,y */ -- 2.43.0