Simplify XNORM() and YNORM()
Simplify (M - (n % M)) % M to M - (n % M), for n < 0.
This commit is contained in:
parent
9c8109768d
commit
5f76428524
1 changed files with 2 additions and 2 deletions
|
@ -43,9 +43,9 @@
|
||||||
#define XYOFFSET(x, y) (((y) * WORLD_X + (x)) / 2)
|
#define XYOFFSET(x, y) (((y) * WORLD_X + (x)) / 2)
|
||||||
|
|
||||||
#define XNORM(x) \
|
#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) \
|
#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 {
|
struct range {
|
||||||
coord lx; /* low-range x,y */
|
coord lx; /* low-range x,y */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue