15 #include <freerdp/config.h>
17 #include <winpr/sysinfo.h>
18 #include "prim_test.h"
20 #define FUNC_TEST_SIZE 65536
22 static BOOL test_add16s_func(
void)
26 INT16 ALIGN(src1[FUNC_TEST_SIZE + 3]) = { 0 };
27 INT16 ALIGN(src2[FUNC_TEST_SIZE + 3]) = { 0 };
28 INT16 ALIGN(d1[FUNC_TEST_SIZE + 3]) = { 0 };
29 INT16 ALIGN(d2[FUNC_TEST_SIZE + 3]) = { 0 };
31 winpr_RAND(src1,
sizeof(src1));
32 winpr_RAND(src2,
sizeof(src2));
33 status =
generic->add_16s(src1 + 1, src2 + 1, d1 + 1, FUNC_TEST_SIZE);
34 if (status != PRIMITIVES_SUCCESS)
38 status = optimized->add_16s(src1 + 1, src2 + 1, d2 + 2, FUNC_TEST_SIZE);
39 if (status != PRIMITIVES_SUCCESS)
46 static BOOL test_add16s_speed(
void)
48 BYTE ALIGN(src1[MAX_TEST_SIZE + 3]);
49 BYTE ALIGN(src2[MAX_TEST_SIZE + 3]);
50 BYTE ALIGN(dst[MAX_TEST_SIZE + 3]);
52 if (!g_TestPrimitivesPerformance)
55 winpr_RAND(src1,
sizeof(src1));
56 winpr_RAND(src2,
sizeof(src2));
58 if (!speed_test(
"add16s",
"aligned", g_Iterations, (speed_test_fkt)generic->add_16s,
59 (speed_test_fkt)optimized->add_16s, src1, src2, dst, FUNC_TEST_SIZE))
65 int TestPrimitivesAdd(
int argc,
char* argv[])
71 prim_test_setup(FALSE);
72 if (!test_add16s_func())
75 if (g_TestPrimitivesPerformance)
77 if (!test_add16s_speed())