Fix: Ensure 31-bit shifts are unsigned. (#10128)

Shifting a signed 32-bit integer by 31 bits is undefined behaviour.
A few more than necessary are switched to unsigned for consistentency.
This commit is contained in:
PeterN
2022-11-04 07:15:59 +00:00
committed by GitHub
parent accbfd502e
commit f24286a1ae
6 changed files with 92 additions and 92 deletions

View File

@@ -81,7 +81,7 @@ DECLARE_ENUM_AS_BIT_SET(Slope)
* Helper for creating a bitset of slopes.
* @param x The slope to convert into a bitset.
*/
#define M(x) (1 << (x))
#define M(x) (1U << (x))
/** Constant bitset with safe slopes for building a level crossing. */
static const uint32 VALID_LEVEL_CROSSING_SLOPES = M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT);
#undef M