From 25e159d96b0618cc7204ee5c18181370ef96a9cd Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 9 May 2023 22:06:26 +0200 Subject: [PATCH] u02/util: Simplify conditions --- u02/src/util.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/u02/src/util.cpp b/u02/src/util.cpp index 78369d0..865136a 100644 --- a/u02/src/util.cpp +++ b/u02/src/util.cpp @@ -3,18 +3,18 @@ #include 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 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) {