/********************************************************************//** Ippx* Function Family Maps a standard CRT call to it's IPP correspondent. *************************************************************************/ #pragma once #include #include /// /// Initializes IPP. /// @return true if IPP has been successfully initialized, false otherwise. /// inline bool IppxInit () { return (ippStaticInit() == ippStsNoErr); } /************************************************************************ Memory functions *************************************************************************/ /// /// Compares two buffers. /// @param[in] _Buf1 The first buffer to compare. /// @param[in] _Buf2 The second buffer to compare. /// @param[in] _Size The length, in bytes, to perform the comparison. /// @return A positive number if _Buf1 > _Buf2, a negative buffer if _Buf1 < _Buf 2 /// or zero if the buffers are equal. /// inline int IppxMemCmp (const void* _Buf1, const void* _Buf2, size_t _Size) { int result; ippsCompare_8u((Ipp8u*)_Buf1, (Ipp8u*)_Buf2, (int)_Size, &result); return result; } /// /// Clears a buffer, by setting its content to zero. /// @param[in] Destination The buffer to be cleared. /// @param[in] Length The buffer's length. /// inline void IppxZeroMemory (void* Destination, size_t Length) { ippsZero_8u((Ipp8u*)Destination, (int)Length); } /// /// Sets a buffer's content to the specified value. /// @param[in] _Dst The buffer to be modified. /// @param[in] _Val The 8-bits value to be set on the buffer. /// @param[in] _Size The amount of bytes to be set. /// inline void IppxMemSet (void* _Dst, int _Val, size_t _Size) { ippsSet_8u((Ipp8u)_Val, (Ipp8u*)_Dst, (int)_Size); } /// /// Copies data between non-overlapping buffers. /// @param[in] _Dst The destination buffer. /// @param[in] _Src The source buffer. /// @param[in] _Size The amount of bytes to be copied. /// @remarks This function does only copying. To perform moving, use ippMemMove. /// If source and destination buffers overlap, the function's behavior is undefined. /// inline void IppxMemCpy (void* _Dst, const void* _Src, size_t _Size) { ippsCopy_8u((Ipp8u*)_Src, (Ipp8u*)_Dst, (int)_Size); } /// /// Copies data between overlapping buffers. /// @param[in] _Dst The buffer's destination offset. /// @param[in] _Src The buffer's source offset. /// @param[in] _Size The amount of bytes to be moved. /// inline void IppxMemMove (void* _Dst, const void* _Src, size_t _Size) { ippsMove_8u((Ipp8u*)_Src, (Ipp8u*)_Dst, (int)_Size); } /************************************************************************ String functions *************************************************************************/ /// /// Gets a string's length. /// @param[in] _Str The string whose length is to be obtained. /// @return The string's length. /// inline int IppxStrLen (const char* _Str) { int index; ippsFindC_8u((Ipp8u*)_Str, ((1 << 30) - 1), 0, &index); return index; }