Fix undefined behaviour when left-shifting negative values by casting to unsigned

This silences warning spam from UndefinedBehaviorSanitizer.
This commit is contained in:
Jonathan G Rennison
2018-06-06 18:25:45 +01:00
parent 6573a67b69
commit e1fb35b16f
4 changed files with 7 additions and 5 deletions

View File

@@ -232,7 +232,7 @@ static inline uint TileY(TileIndex tile)
*/
static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
{
return (tidc.y << MapLogX()) + tidc.x;
return (((uint) tidc.y) << MapLogX()) + tidc.x;
}