Skip to content

Commit

Permalink
swap variables in for loops
Browse files Browse the repository at this point in the history
These might be swapped. The second parameter is definitely degrees.
  • Loading branch information
neheb committed Jan 4, 2023
1 parent b85239a commit 5cb8d06
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ class RotationMap {
//! Helper structure for the mapping list
using OmList = std::pair<uint16_t, int32_t>;
// 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;
Expand All @@ -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;
Expand Down

0 comments on commit 5cb8d06

Please sign in to comment.