15 #include <freerdp/config.h>
17 #include <winpr/sysinfo.h>
18 #include "prim_test.h"
20 #define TEST_BUFFER_SIZE 65535
23 static BOOL test_sign16s_func(
void)
26 INT16 ALIGN(src[TEST_BUFFER_SIZE + 16]) = { 0 };
27 INT16 ALIGN(d1[TEST_BUFFER_SIZE + 16]) = { 0 };
28 INT16 ALIGN(d2[TEST_BUFFER_SIZE + 16]) = { 0 };
29 winpr_RAND(src,
sizeof(src));
30 status =
generic->sign_16s(src + 1, d1 + 1, TEST_BUFFER_SIZE);
32 if (status != PRIMITIVES_SUCCESS)
35 status = optimized->sign_16s(src + 1, d2 + 1, TEST_BUFFER_SIZE);
37 if (status != PRIMITIVES_SUCCESS)
40 if (memcmp(d1, d2,
sizeof(d1)) != 0)
43 status =
generic->sign_16s(src + 1, d1 + 2, TEST_BUFFER_SIZE);
45 if (status != PRIMITIVES_SUCCESS)
48 status = optimized->sign_16s(src + 1, d2 + 2, TEST_BUFFER_SIZE);
50 if (status != PRIMITIVES_SUCCESS)
53 if (memcmp(d1, d2,
sizeof(d1)) != 0)
59 static int test_sign16s_speed(
void)
61 INT16 ALIGN(src[MAX_TEST_SIZE + 3]) = { 0 };
62 INT16 ALIGN(dst[MAX_TEST_SIZE + 3]) = { 0 };
63 winpr_RAND(src,
sizeof(src));
65 if (!speed_test(
"sign16s",
"aligned", g_Iterations, (speed_test_fkt)generic->sign_16s,
66 (speed_test_fkt)optimized->sign_16s, src + 1, dst + 1, MAX_TEST_SIZE))
69 if (!speed_test(
"sign16s",
"unaligned", g_Iterations, (speed_test_fkt)generic->sign_16s,
70 (speed_test_fkt)optimized->sign_16s, src + 1, dst + 2, MAX_TEST_SIZE))
76 int TestPrimitivesSign(
int argc,
char* argv[])
81 prim_test_setup(FALSE);
83 if (!test_sign16s_func())
86 if (g_TestPrimitivesPerformance)
88 if (!test_sign16s_speed())