1
0
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:
Richard Fine
2019-01-06 11:58:28 +00:00
parent b77f1285a4
commit 3b9dd87caf

View File

@@ -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;
}