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
1 changed files with 1 additions and 1 deletions

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