17 #include <freerdp/config.h>
21 #include <freerdp/types.h>
22 #include <freerdp/primitives.h>
24 #include "prim_internal.h"
30 static INLINE INT16 add(INT16 a, INT16 b)
32 INT32 k = (INT32)a + (INT32)b;
43 static pstatus_t general_add_16s(
const INT16* WINPR_RESTRICT pSrc1,
44 const INT16* WINPR_RESTRICT pSrc2, INT16* WINPR_RESTRICT pDst,
47 const UINT32 rem = len % 16;
48 const UINT32 align = len - rem;
50 for (UINT32 x = 0; x < align; x++)
51 *pDst++ = add(*pSrc1++, *pSrc2++);
53 for (UINT32 x = 0; x < rem; x++)
54 *pDst++ = add(*pSrc1++, *pSrc2++);
56 return PRIMITIVES_SUCCESS;
59 static pstatus_t general_add_16s_inplace(INT16* WINPR_RESTRICT pSrcDst1,
60 INT16* WINPR_RESTRICT pSrcDst2, UINT32 len)
62 for (UINT32 x = 0; x < len; x++)
64 INT16 v = add(pSrcDst1[x], pSrcDst2[x]);
69 return PRIMITIVES_SUCCESS;
73 void primitives_init_add(
primitives_t* WINPR_RESTRICT prims)
75 prims->add_16s = general_add_16s;
76 prims->add_16s_inplace = general_add_16s_inplace;
79 void primitives_init_add_opt(
primitives_t* WINPR_RESTRICT prims)
81 primitives_init_add_sse3(prims);