From 5e18b0149adb93f410846801fc5c8a92036209bd Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Fri, 27 Feb 2026 07:38:16 +0100 Subject: [PATCH] [primitives,test] drop ALIGN macro --- .../primitives/test/TestPrimitivesAdd.c | 14 +++---- .../primitives/test/TestPrimitivesAlphaComp.c | 12 +++--- .../primitives/test/TestPrimitivesAndOr.c | 16 ++++---- .../primitives/test/TestPrimitivesColors.c | 26 ++++++------ .../primitives/test/TestPrimitivesCopy.c | 8 ++-- .../primitives/test/TestPrimitivesShift.c | 40 +++++++++---------- .../primitives/test/TestPrimitivesSign.c | 16 ++++---- libfreerdp/primitives/test/prim_test.h | 6 --- 8 files changed, 67 insertions(+), 71 deletions(-) diff --git a/libfreerdp/primitives/test/TestPrimitivesAdd.c b/libfreerdp/primitives/test/TestPrimitivesAdd.c index 6c1aeeaf8..5923b9abe 100644 --- a/libfreerdp/primitives/test/TestPrimitivesAdd.c +++ b/libfreerdp/primitives/test/TestPrimitivesAdd.c @@ -23,10 +23,10 @@ static BOOL test_add16s_func(void) { pstatus_t status = 0; - INT16 ALIGN(src1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(src2[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d2[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + INT16 src1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 src2[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 d2[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src1, sizeof(src1)) < 0) return FALSE; @@ -44,9 +44,9 @@ static BOOL test_add16s_func(void) /* ------------------------------------------------------------------------- */ static BOOL test_add16s_speed(void) { - BYTE ALIGN(src1[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(src2[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(dst[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + BYTE src1[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + BYTE src2[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + BYTE dst[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (!g_TestPrimitivesPerformance) return TRUE; diff --git a/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c b/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c index d565a6bc9..4dc372183 100644 --- a/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c +++ b/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c @@ -117,9 +117,9 @@ static BOOL check(const BYTE* pSrc1, UINT32 src1Step, const BYTE* pSrc2, UINT32 static BOOL test_alphaComp_func(void) { pstatus_t status = 0; - BYTE ALIGN(src1[SRC1_WIDTH * SRC1_HEIGHT * 4]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(src2[SRC2_WIDTH * SRC2_HEIGHT * 4]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]) = WINPR_C_ARRAY_INIT; + BYTE src1[SRC1_WIDTH * SRC1_HEIGHT * 4] = WINPR_C_ARRAY_INIT; + BYTE src2[SRC2_WIDTH * SRC2_HEIGHT * 4] = WINPR_C_ARRAY_INIT; + BYTE dst1[DST_WIDTH * DST_HEIGHT * 4] = WINPR_C_ARRAY_INIT; UINT32* ptr = nullptr; if (winpr_RAND(src1, sizeof(src1)) < 0) return FALSE; @@ -160,9 +160,9 @@ static BOOL test_alphaComp_func(void) static int test_alphaComp_speed(void) { - BYTE ALIGN(src1[SRC1_WIDTH * SRC1_HEIGHT]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(src2[SRC2_WIDTH * SRC2_HEIGHT]) = WINPR_C_ARRAY_INIT; - BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT]) = WINPR_C_ARRAY_INIT; + BYTE src1[SRC1_WIDTH * SRC1_HEIGHT] = WINPR_C_ARRAY_INIT; + BYTE src2[SRC2_WIDTH * SRC2_HEIGHT] = WINPR_C_ARRAY_INIT; + BYTE dst1[DST_WIDTH * DST_HEIGHT] = WINPR_C_ARRAY_INIT; UINT32* ptr = nullptr; if (winpr_RAND(src1, sizeof(src1)) < 0) diff --git a/libfreerdp/primitives/test/TestPrimitivesAndOr.c b/libfreerdp/primitives/test/TestPrimitivesAndOr.c index 1f34854ad..a23646bf7 100644 --- a/libfreerdp/primitives/test/TestPrimitivesAndOr.c +++ b/libfreerdp/primitives/test/TestPrimitivesAndOr.c @@ -48,8 +48,8 @@ static BOOL test_and_32u_impl(const char* name, fn_andC_32u_t fkt, const UINT32* static BOOL test_and_32u_func(void) { - UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT32 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT32 dst[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; @@ -73,8 +73,8 @@ static BOOL test_and_32u_func(void) /* ------------------------------------------------------------------------- */ static BOOL test_and_32u_speed(void) { - UINT32 ALIGN(src[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT32 ALIGN(dst[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT32 src[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT32 dst[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; @@ -109,8 +109,8 @@ static BOOL check(const UINT32* src, const UINT32* dst, UINT32 size, UINT32 valu static BOOL test_or_32u_func(void) { pstatus_t status = 0; - UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT32 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT32 dst[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; @@ -135,8 +135,8 @@ static BOOL test_or_32u_func(void) /* ------------------------------------------------------------------------- */ static BOOL test_or_32u_speed(void) { - UINT32 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT32 ALIGN(dst[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT32 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT32 dst[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; diff --git a/libfreerdp/primitives/test/TestPrimitivesColors.c b/libfreerdp/primitives/test/TestPrimitivesColors.c index 727917b8f..e4e509b47 100644 --- a/libfreerdp/primitives/test/TestPrimitivesColors.c +++ b/libfreerdp/primitives/test/TestPrimitivesColors.c @@ -111,10 +111,10 @@ static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void) INT16** pv; } cnv; const prim_size_t roi64x64 = { 64, 64 }; - INT16 ALIGN(r[4096 + 1]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(g[4096 + 1]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(b[4096 + 1]) = WINPR_C_ARRAY_INIT; - UINT32 ALIGN(dst[4096 + 1]) = WINPR_C_ARRAY_INIT; + INT16 r[4096 + 1] = WINPR_C_ARRAY_INIT; + INT16 g[4096 + 1] = WINPR_C_ARRAY_INIT; + INT16 b[4096 + 1] = WINPR_C_ARRAY_INIT; + UINT32 dst[4096 + 1] = WINPR_C_ARRAY_INIT; INT16* ptrs[3] = WINPR_C_ARRAY_INIT; if (winpr_RAND(r, sizeof(r)) < 0) return FALSE; @@ -155,15 +155,15 @@ static BOOL test_RGBToRGB_16s8u_P3AC4R_speed(void) static BOOL test_yCbCrToRGB_16s16s_P3P3_func(void) { pstatus_t status = 0; - INT16 ALIGN(y[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(cb[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(cr[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(r1[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(g1[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(b1[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(r2[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(g2[4096]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(b2[4096]) = WINPR_C_ARRAY_INIT; + INT16 y[4096] = WINPR_C_ARRAY_INIT; + INT16 cb[4096] = WINPR_C_ARRAY_INIT; + INT16 cr[4096] = WINPR_C_ARRAY_INIT; + INT16 r1[4096] = WINPR_C_ARRAY_INIT; + INT16 g1[4096] = WINPR_C_ARRAY_INIT; + INT16 b1[4096] = WINPR_C_ARRAY_INIT; + INT16 r2[4096] = WINPR_C_ARRAY_INIT; + INT16 g2[4096] = WINPR_C_ARRAY_INIT; + INT16 b2[4096] = WINPR_C_ARRAY_INIT; const INT16* in[3]; INT16* out1[3]; INT16* out2[3]; diff --git a/libfreerdp/primitives/test/TestPrimitivesCopy.c b/libfreerdp/primitives/test/TestPrimitivesCopy.c index d8336cadd..657af5eed 100644 --- a/libfreerdp/primitives/test/TestPrimitivesCopy.c +++ b/libfreerdp/primitives/test/TestPrimitivesCopy.c @@ -26,7 +26,7 @@ static BOOL test_copy8u_func(void) { primitives_t* prims = primitives_get(); - BYTE ALIGN(data[COPY_TESTSIZE + 15]) = WINPR_C_ARRAY_INIT; + BYTE data[COPY_TESTSIZE + 15] = WINPR_C_ARRAY_INIT; if (winpr_RAND(data, sizeof(data)) < 0) return FALSE; @@ -36,7 +36,7 @@ static BOOL test_copy8u_func(void) { for (int length = 1; length <= COPY_TESTSIZE - doff; ++length) { - BYTE ALIGN(dest[COPY_TESTSIZE + 15]) = WINPR_C_ARRAY_INIT; + BYTE dest[COPY_TESTSIZE + 15] = WINPR_C_ARRAY_INIT; if (prims->copy_8u(data + soff, dest + doff, length) != PRIMITIVES_SUCCESS) return FALSE; @@ -61,8 +61,8 @@ static BOOL test_copy8u_func(void) /* ------------------------------------------------------------------------- */ static BOOL test_copy8u_speed(void) { - BYTE ALIGN(src[MAX_TEST_SIZE + 4]); - BYTE ALIGN(dst[MAX_TEST_SIZE + 4]); + BYTE src[MAX_TEST_SIZE + 4] = WINPR_C_ARRAY_INIT; + BYTE dst[MAX_TEST_SIZE + 4] = WINPR_C_ARRAY_INIT; if (!speed_test("copy_8u", "aligned", g_Iterations, (speed_test_fkt)generic->copy_8u, (speed_test_fkt)optimized->copy_8u, src, dst, MAX_TEST_SIZE)) diff --git a/libfreerdp/primitives/test/TestPrimitivesShift.c b/libfreerdp/primitives/test/TestPrimitivesShift.c index f496f9d12..2405c64f8 100644 --- a/libfreerdp/primitives/test/TestPrimitivesShift.c +++ b/libfreerdp/primitives/test/TestPrimitivesShift.c @@ -22,8 +22,8 @@ static BOOL test_lShift_16s_func(void) { pstatus_t status = 0; - INT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + INT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 val = 0; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; @@ -66,8 +66,8 @@ static BOOL test_lShift_16s_func(void) static BOOL test_lShift_16u_func(void) { pstatus_t status = 0; - UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 val = 0; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; @@ -111,8 +111,8 @@ static BOOL test_lShift_16u_func(void) static BOOL test_rShift_16s_func(void) { pstatus_t status = 0; - INT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + INT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 val = 0; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; @@ -156,8 +156,8 @@ static BOOL test_rShift_16s_func(void) static BOOL test_rShift_16u_func(void) { pstatus_t status = 0; - UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 val = 0; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; @@ -200,8 +200,8 @@ static BOOL test_rShift_16u_func(void) static BOOL test_ShiftWrapper_16s_func(void) { pstatus_t status = 0; - INT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + INT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 tmp = 0; if (winpr_RAND(&tmp, sizeof(tmp)) < 0) return FALSE; @@ -265,8 +265,8 @@ static BOOL test_ShiftWrapper_16s_func(void) static BOOL test_ShiftWrapper_16u_func(void) { pstatus_t status = 0; - UINT16 ALIGN(src[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - UINT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; + UINT16 src[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + UINT16 d1[FUNC_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; UINT32 tmp = 0; if (winpr_RAND(&tmp, sizeof(tmp)) < 0) return FALSE; @@ -330,8 +330,8 @@ static BOOL test_ShiftWrapper_16u_func(void) static BOOL test_lShift_16s_speed(void) { UINT32 val = 0; - INT16 ALIGN(src[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(dst[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; + INT16 src[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; + INT16 dst[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; if (winpr_RAND(&val, sizeof(val))) @@ -353,8 +353,8 @@ static BOOL test_lShift_16s_speed(void) static BOOL test_lShift_16u_speed(void) { UINT32 val = 0; - UINT16 ALIGN(src[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; - UINT16 ALIGN(dst[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; + UINT16 src[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; + UINT16 dst[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; if (winpr_RAND(src, sizeof(src)) < 0) @@ -376,8 +376,8 @@ static BOOL test_lShift_16u_speed(void) static BOOL test_rShift_16s_speed(void) { UINT32 val = 0; - INT16 ALIGN(src[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(dst[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; + INT16 src[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; + INT16 dst[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; if (winpr_RAND(src, sizeof(src)) < 0) return FALSE; if (winpr_RAND(&val, sizeof(val)) < 0) @@ -399,8 +399,8 @@ static BOOL test_rShift_16s_speed(void) static BOOL test_rShift_16u_speed(void) { UINT32 val = 0; - UINT16 ALIGN(src[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; - UINT16 ALIGN(dst[MAX_TEST_SIZE + 1]) = WINPR_C_ARRAY_INIT; + UINT16 src[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; + UINT16 dst[MAX_TEST_SIZE + 1] = WINPR_C_ARRAY_INIT; if (winpr_RAND(&val, sizeof(val)) < 0) return FALSE; if (winpr_RAND(src, sizeof(src)) < 0) diff --git a/libfreerdp/primitives/test/TestPrimitivesSign.c b/libfreerdp/primitives/test/TestPrimitivesSign.c index fb2169a0a..c2eec4759 100644 --- a/libfreerdp/primitives/test/TestPrimitivesSign.c +++ b/libfreerdp/primitives/test/TestPrimitivesSign.c @@ -23,10 +23,11 @@ static BOOL test_sign16s_func(void) { pstatus_t status = 0; - INT16 ALIGN(src[TEST_BUFFER_SIZE + 16]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d1[TEST_BUFFER_SIZE + 16]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(d2[TEST_BUFFER_SIZE + 16]) = WINPR_C_ARRAY_INIT; - winpr_RAND(src, sizeof(src)); + INT16 src[TEST_BUFFER_SIZE + 16] = WINPR_C_ARRAY_INIT; + INT16 d1[TEST_BUFFER_SIZE + 16] = WINPR_C_ARRAY_INIT; + INT16 d2[TEST_BUFFER_SIZE + 16] = WINPR_C_ARRAY_INIT; + if (winpr_RAND(src, sizeof(src)) < 0) + return FALSE; status = generic->sign_16s(src + 1, d1 + 1, TEST_BUFFER_SIZE); if (status != PRIMITIVES_SUCCESS) @@ -58,9 +59,10 @@ static BOOL test_sign16s_func(void) static int test_sign16s_speed(void) { - INT16 ALIGN(src[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - INT16 ALIGN(dst[MAX_TEST_SIZE + 3]) = WINPR_C_ARRAY_INIT; - winpr_RAND(src, sizeof(src)); + INT16 src[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + INT16 dst[MAX_TEST_SIZE + 3] = WINPR_C_ARRAY_INIT; + if (winpr_RAND(src, sizeof(src)) < 0) + return FALSE; if (!speed_test("sign16s", "aligned", g_Iterations, (speed_test_fkt)generic->sign_16s, (speed_test_fkt)optimized->sign_16s, src + 1, dst + 1, MAX_TEST_SIZE)) diff --git a/libfreerdp/primitives/test/prim_test.h b/libfreerdp/primitives/test/prim_test.h index 06db846d9..81d4fc5f8 100644 --- a/libfreerdp/primitives/test/prim_test.h +++ b/libfreerdp/primitives/test/prim_test.h @@ -26,12 +26,6 @@ #include "measure.h" -#ifdef _WIN32 -#define ALIGN(x) x -#else -#define ALIGN(x) x DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) -#endif - #define ABS(_x_) ((_x_) < 0 ? (-(_x_)) : (_x_)) #define MAX_TEST_SIZE 4096