mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 16:54:52 +01:00
Make direction_reverse constexpr and pass arg by value
To make totally sure that the compiler understands it can fully compute the value at compile time when dealing with constant inputs, and to make totally sure there are no aliasing problems.
This commit is contained in:
@@ -144,7 +144,7 @@ typedef uint8_t Direction;
|
||||
* Given a direction, return the direction that points the other way,
|
||||
* on the same axis.
|
||||
*/
|
||||
inline Direction direction_reverse(const Direction& dir)
|
||||
constexpr Direction direction_reverse(Direction dir)
|
||||
{
|
||||
return dir ^ 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user