u02/util: Simplify conditions

filtered
Simon Bruder 2023-05-09 22:06:26 +02:00
parent 7e8dbfabea
commit 25e159d96b
1 changed files with 6 additions and 6 deletions

View File

@ -3,18 +3,18 @@
#include <cmath>
void transform_mut(Transformation transformation, int &x, int &y) {
if ((transformation & TRANSFORM_ROTATE_CW) != 0) {
if (transformation & TRANSFORM_ROTATE_CW) {
std::swap(x, y);
x = -x;
}
if ((transformation & TRANSFORM_ROTATE_CCW) != 0) {
if (transformation & TRANSFORM_ROTATE_CCW) {
std::swap(x, y);
y = -y;
}
if ((transformation & TRANSFORM_MIRROR_X) != 0) {
if (transformation & TRANSFORM_MIRROR_X) {
y = -y;
}
if ((transformation & TRANSFORM_MIRROR_Y) != 0) {
if (transformation & TRANSFORM_MIRROR_Y) {
x = -x;
}
}
@ -25,10 +25,10 @@ std::pair<int, int> transform(Transformation transformation, int x, int y) {
}
void transform_inv_mut(Transformation transformation, int &x, int &y) {
if ((transformation & TRANSFORM_MIRROR_Y) != 0) {
if (transformation & TRANSFORM_MIRROR_Y) {
x = -x;
}
if ((transformation & TRANSFORM_MIRROR_X) != 0) {
if (transformation & TRANSFORM_MIRROR_X) {
y = -y;
}
if (transformation & TRANSFORM_ROTATE_CCW) {