Fix undefined behaviour when left-shifting negative values by casting to unsigned
This silences warning spam from UndefinedBehaviorSanitizer.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
static inline int ScaleByZoom(int value, ZoomLevel zoom)
|
||||
{
|
||||
assert(zoom >= 0);
|
||||
return value << zoom;
|
||||
return ((uint) value) << zoom;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ static inline int UnScaleByZoom(int value, ZoomLevel zoom)
|
||||
static inline int ScaleByZoomLower(int value, ZoomLevel zoom)
|
||||
{
|
||||
assert(zoom >= 0);
|
||||
return value << zoom;
|
||||
return ((uint) value) << zoom;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user