Skip to content

Commit

Permalink
remove some {} for readability
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Mar 4, 2025
1 parent be66a51 commit f5c2ce8
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,25 @@ class RotationMap {
// DATA
static const OmList omList_[];
}; // 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&& [orient, deg] : omList_) {
if (deg == degrees) {
o = orient;
break;
}
}
return o;
for (auto&& [orient, deg] : omList_)
if (deg == degrees)
return orient;
return 1;
}

int32_t RotationMap::degrees(uint16_t orientation) {
int32_t d = 0;
for (auto&& [orient, deg] : omList_) {
if (orient == orientation) {
d = deg;
break;
}
}
return d;
for (auto&& [orient, deg] : omList_)
if (orient == orientation)
return deg;
return 0;
}
} // namespace

Expand Down

0 comments on commit f5c2ce8

Please sign in to comment.