SwapBytes

Reverses the byte order of a vector.

Syntax

IppStatus ippsSwapBytes_16u(const Ipp16u* pSrc, Ipp16u* pDst, int len);

IppStatus ippsSwapBytes_24u(const Ipp8u* pSrc, Ipp8u* pDst, int len);

IppStatus ippsSwapBytes_32u(const Ipp32u* pSrc, Ipp32u* pDst, int len);

IppStatus ippsSwapBytes_64u(const Ipp64u* pSrc, Ipp64u* pDst, int len);

IppStatus ippsSwapBytes_16u_I(Ipp16u* pSrcDst, int len);

IppStatus ippsSwapBytes_24u_I(Ipp8u* pSrcDst, int len);

IppStatus ippsSwapBytes_32u_I(Ipp32u* pSrcDst, int len);

IppStatus ippsSwapBytes_64u_I(Ipp64u* pSrcDst, int len);

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

pSrcDst

Pointer to the source and destination vector for the in-place operation.

len

Number of elements in the vector.

Description

The function ippsSwapBytes is declared in the ipps.h file. This function reverses the endian order (byte order) of the source vector pSrc (pSrcDst for the in-place operation) and stores the result in pDst (pSrcDst). When the low-order byte is stored in memory at the lowest address, and the high-order byte at the highest address, the little-endian order is implemented.When the high-order byte is stored in memory at the lowest address, and the low-order byte at the highest address, the big-endian order is implemented. The function ippsSwapBytes allows to switch from one order to the other in either direction.

The example below shows how to call the function ippsSwapBytes_16u_I.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

Using the Function ippsSwapBytes

void func_swap()
{
    Ipp16u vec[2] = {0x1234,0x5678};
    IppStatus status;

		
    status = ippsSwapBytes_16u_I(vec, 2);
    if(ippStsNoErr != status)
      printf("IPP Error: %s",ippGetStatusString(status));
}
result     
vec[0] = 0x3412 
vec[1] = 0x7856

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.