From 5cb8d061eb7696990ee6eb2646503dfd0b7026b5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 3 Jan 2023 22:01:05 -0800 Subject: [PATCH] swap variables in for loops These might be swapped. The second parameter is definitely degrees. --- src/crwimage_int.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 923cd2c4df..5279386ca9 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -24,20 +24,19 @@ class RotationMap { //! Helper structure for the mapping list using OmList = std::pair; // DATA - static const OmList omList_[]; + static constexpr OmList omList_[] = { + {1, 0}, {3, 180}, {3, -180}, {6, 90}, {6, -270}, {8, 270}, {8, -90}, + }; }; // class RotationMap } // namespace // ***************************************************************************** // local definitions namespace { -constexpr RotationMap::OmList RotationMap::omList_[] = { - {1, 0}, {3, 180}, {3, -180}, {6, 90}, {6, -270}, {8, 270}, {8, -90}, -}; uint16_t RotationMap::orientation(int32_t degrees) { uint16_t o = 1; - for (auto&& [deg, orient] : omList_) { + for (auto&& [orient, deg] : omList_) { if (deg == degrees) { o = orient; break; @@ -48,7 +47,7 @@ uint16_t RotationMap::orientation(int32_t degrees) { int32_t RotationMap::degrees(uint16_t orientation) { int32_t d = 0; - for (auto&& [deg, orient] : omList_) { + for (auto&& [orient, deg] : omList_) { if (orient == orientation) { d = deg; break;