Fix UB in tileat()
This commit is contained in:
1 parent
61c0e17fd8
commit
2c8d01df49
1 file changed
+2
-2
+2
-2
@@ -144,8 +144,8 @@ static inline double dot(dvec_t v, dvec_t u)
|
||||
static inline unsigned
|
||||
tileat(const map_t map, int layeridx, double x, double y)
|
||||
{
|
||||
const unsigned row = (unsigned)floor(x / TILESIZE) + MAPSHIFTX;
|
||||
const unsigned col = (unsigned)floor(y / TILESIZE) + MAPSHIFTY;
|
||||
const unsigned row = (unsigned)(floor(x / TILESIZE) + MAPSHIFTX);
|
||||
const unsigned col = (unsigned)(floor(y / TILESIZE) + MAPSHIFTY);
|
||||
if (row >= MAPWIDTH || col >= MAPHEIGHT)
|
||||
return 0;
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user