#include <stdio.h>
#include "ipp.h"
/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if IPP function returned status different from ippStsNoErr */
/* Results of ippMalloc() are not validated because Intel(R) Integrated Performance Primitives functions perform bad arguments check and will return an appropriate status */
int main()
{
int len = 32;
int i;
Ipp16s *pSrc = ippsMalloc_16s(len * sizeof(Ipp16s));
Ipp16s *pDst = ippsMalloc_16s(len * sizeof(Ipp16s));
IppStatus status;
int scale = 0; //without scaling
printf("\n\nSource vector\n");
for (i = 0; i < len; i++)
{
pSrc[i] = 2 + i;
printf("%d; ", pSrc[i]);
}
check_sts(status = ippsSqr_16s_Sfs(pSrc, pDst, len, scale));
printf("\n\nResult\n");
for (i = 0; i < len; i++) printf("%d; ", pDst[i]);
printf("\n\n");
EXIT_MAIN
ippsFree(pSrc);
ippsFree(pDst);
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}