mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Bridges: Fix off-by-one in WITHIN()
WITHIN() used to treat the min and max as inclusive bounds but was changed to treat the max as exclusive, apparently accidentally. Fixed: 5f5b284c0bdd ("Use C99 bool within source modules.")
This commit is contained in:

committed by
Simon Tatham

parent
cd338a1a35
commit
4c1e47b272
@ -183,7 +183,7 @@ struct game_state {
|
|||||||
|
|
||||||
#define GRIDCOUNT(s,x,y,f) ((GRID(s,x,y) & (f)) ? (INDEX(s,lines,x,y)) : 0)
|
#define GRIDCOUNT(s,x,y,f) ((GRID(s,x,y) & (f)) ? (INDEX(s,lines,x,y)) : 0)
|
||||||
|
|
||||||
#define WITHIN2(x,min,max) ((x) >= (min) && (x) < (max))
|
#define WITHIN2(x,min,max) ((x) >= (min) && (x) <= (max))
|
||||||
#define WITHIN(x,min,max) ((min) > (max) ? \
|
#define WITHIN(x,min,max) ((min) > (max) ? \
|
||||||
WITHIN2(x,max,min) : WITHIN2(x,min,max))
|
WITHIN2(x,max,min) : WITHIN2(x,min,max))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user