Issue #1925 - Convert half-corner index macros to an enum.

This commit is contained in:
Moonchild 2024-08-02 08:01:01 +02:00 • committed by roytam1
commit 8dc8875db6
9 changed files with 138 additions and 135 deletions

View file

@ -341,42 +341,42 @@ CASE(eSideLeft, true);
#define CASE(corner, result) \
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
"NS_HALF_CORNER_IS_X is wrong")
CASE(NS_CORNER_TOP_LEFT_X, true);
CASE(NS_CORNER_TOP_LEFT_Y, false);
CASE(NS_CORNER_TOP_RIGHT_X, true);
CASE(NS_CORNER_TOP_RIGHT_Y, false);
CASE(NS_CORNER_BOTTOM_RIGHT_X, true);
CASE(NS_CORNER_BOTTOM_RIGHT_Y, false);
CASE(NS_CORNER_BOTTOM_LEFT_X, true);
CASE(NS_CORNER_BOTTOM_LEFT_Y, false);
CASE(eCornerTopLeftX, true);
CASE(eCornerTopLeftY, false);
CASE(eCornerTopRightX, true);
CASE(eCornerTopRightY, false);
CASE(eCornerBottomRightX, true);
CASE(eCornerBottomRightY, false);
CASE(eCornerBottomLeftX, true);
CASE(eCornerBottomLeftY, false);
#undef CASE
// Validation of NS_HALF_TO_FULL_CORNER.
#define CASE(corner, result) \
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
"NS_HALF_TO_FULL_CORNER is wrong")
CASE(NS_CORNER_TOP_LEFT_X, eCornerTopLeft);
CASE(NS_CORNER_TOP_LEFT_Y, eCornerTopLeft);
CASE(NS_CORNER_TOP_RIGHT_X, eCornerTopRight);
CASE(NS_CORNER_TOP_RIGHT_Y, eCornerTopRight);
CASE(NS_CORNER_BOTTOM_RIGHT_X, eCornerBottomRight);
CASE(NS_CORNER_BOTTOM_RIGHT_Y, eCornerBottomRight);
CASE(NS_CORNER_BOTTOM_LEFT_X, eCornerBottomLeft);
CASE(NS_CORNER_BOTTOM_LEFT_Y, eCornerBottomLeft);
CASE(eCornerTopLeftX, eCornerTopLeft);
CASE(eCornerTopLeftY, eCornerTopLeft);
CASE(eCornerTopRightX, eCornerTopRight);
CASE(eCornerTopRightY, eCornerTopRight);
CASE(eCornerBottomRightX, eCornerBottomRight);
CASE(eCornerBottomRightY, eCornerBottomRight);
CASE(eCornerBottomLeftX, eCornerBottomLeft);
CASE(eCornerBottomLeftY, eCornerBottomLeft);
#undef CASE
// Validation of NS_FULL_TO_HALF_CORNER.
#define CASE(corner, vert, result) \
static_assert(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
"NS_FULL_TO_HALF_CORNER is wrong")
CASE(eCornerTopLeft, false, NS_CORNER_TOP_LEFT_X);
CASE(eCornerTopLeft, true, NS_CORNER_TOP_LEFT_Y);
CASE(eCornerTopRight, false, NS_CORNER_TOP_RIGHT_X);
CASE(eCornerTopRight, true, NS_CORNER_TOP_RIGHT_Y);
CASE(eCornerBottomRight, false, NS_CORNER_BOTTOM_RIGHT_X);
CASE(eCornerBottomRight, true, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(eCornerBottomLeft, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(eCornerBottomLeft, true, NS_CORNER_BOTTOM_LEFT_Y);
CASE(eCornerTopLeft, false, eCornerTopLeftX);
CASE(eCornerTopLeft, true, eCornerTopLeftY);
CASE(eCornerTopRight, false, eCornerTopRightX);
CASE(eCornerTopRight, true, eCornerTopRightY);
CASE(eCornerBottomRight, false, eCornerBottomRightX);
CASE(eCornerBottomRight, true, eCornerBottomRightY);
CASE(eCornerBottomLeft, false, eCornerBottomLeftX);
CASE(eCornerBottomLeft, true, eCornerBottomLeftY);
#undef CASE
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
@ -399,23 +399,23 @@ CASE(eSideLeft, true, eCornerTopLeft);
#define CASE(side, second, parallel, result) \
static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
"NS_SIDE_TO_HALF_CORNER is wrong")
CASE(eSideTop, false, true, NS_CORNER_TOP_LEFT_X);
CASE(eSideTop, false, false, NS_CORNER_TOP_LEFT_Y);
CASE(eSideTop, true, true, NS_CORNER_TOP_RIGHT_X);
CASE(eSideTop, true, false, NS_CORNER_TOP_RIGHT_Y);
CASE(eSideTop, false, true, eCornerTopLeftX);
CASE(eSideTop, false, false, eCornerTopLeftY);
CASE(eSideTop, true, true, eCornerTopRightX);
CASE(eSideTop, true, false, eCornerTopRightY);
CASE(eSideRight, false, false, NS_CORNER_TOP_RIGHT_X);
CASE(eSideRight, false, true, NS_CORNER_TOP_RIGHT_Y);
CASE(eSideRight, true, false, NS_CORNER_BOTTOM_RIGHT_X);
CASE(eSideRight, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(eSideRight, false, false, eCornerTopRightX);
CASE(eSideRight, false, true, eCornerTopRightY);
CASE(eSideRight, true, false, eCornerBottomRightX);
CASE(eSideRight, true, true, eCornerBottomRightY);
CASE(eSideBottom, false, true, NS_CORNER_BOTTOM_RIGHT_X);
CASE(eSideBottom, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(eSideBottom, true, true, NS_CORNER_BOTTOM_LEFT_X);
CASE(eSideBottom, true, false, NS_CORNER_BOTTOM_LEFT_Y);
CASE(eSideBottom, false, true, eCornerBottomRightX);
CASE(eSideBottom, false, false, eCornerBottomRightY);
CASE(eSideBottom, true, true, eCornerBottomLeftX);
CASE(eSideBottom, true, false, eCornerBottomLeftY);
CASE(eSideLeft, false, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(eSideLeft, false, true, NS_CORNER_BOTTOM_LEFT_Y);
CASE(eSideLeft, true, false, NS_CORNER_TOP_LEFT_X);
CASE(eSideLeft, true, true, NS_CORNER_TOP_LEFT_Y);
CASE(eSideLeft, false, false, eCornerBottomLeftX);
CASE(eSideLeft, false, true, eCornerBottomLeftY);
CASE(eSideLeft, true, false, eCornerTopLeftX);
CASE(eSideLeft, true, true, eCornerTopLeftY);
#undef CASE