From 3b9dd87caf8e45d4ef5d4e9252ec68c046fad9c9 Mon Sep 17 00:00:00 2001 From: Richard Fine Date: Sun, 6 Jan 2019 11:58:28 +0000 Subject: [PATCH] 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. --- src/openrct2/world/Location.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index ea87892ee1..59b1e1cf57 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -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; }