diff --git a/src/direction_func.h b/src/direction_func.h --- a/src/direction_func.h +++ b/src/direction_func.h @@ -71,7 +71,7 @@ inline DirDiff DirDifference(Direction d assert(IsValidDirection(d1)); /* Cast to uint so compiler can use bitmask. If the difference is negative * and we used int instead of uint, further "+ 8" would have to be added. */ - return (DirDiff)((uint)(d0 - d1) % 8); + return static_cast(static_cast(d0) - static_cast(d1) % 8); } /** @@ -88,7 +88,7 @@ inline DirDiff DirDifference(Direction d inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta) { /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (DirDiff)((uint)(d + delta) % 8); + return static_cast((static_cast(d) + static_cast(delta)) % 8); } /** @@ -105,7 +105,7 @@ inline Direction ChangeDir(Direction d, { assert(IsValidDirection(d)); /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (Direction)((uint)(d + delta) % 8); + return static_cast((static_cast(d) + static_cast(delta)) % 8); } @@ -150,7 +150,7 @@ inline DiagDirection ChangeDiagDir(DiagD { assert(IsValidDiagDirection(d)); /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (DiagDirection)((uint)(d + delta) % 4); + return static_cast((static_cast(d) + static_cast(delta)) % 4); } /**