Texas Instruments TMS320C64X Programmer's Reference Manual page 106

Dsp little-endian dsp library
Hide thumbs Also See for TMS320C64X:
Table of Contents

Advertisement

DSP_blk_eswap16
DSP_blk_eswap16
Function
Arguments
Description
Algorithm
4-78
Endian-Swap a Block of 16-Bit Values
void blk_eswap16(void * restrict x, void * restrict r, int nx)
x [nx]
Source data. Must be double-word aligned.
r [nx]
Destination array. Must be double-word aligned.
nx
Number of 16-bit values to swap. Must be multiple of 8.
The data in the x[] array is endian swapped, meaning that the byte-order of the
bytes within each half-word of the r[] array is reversed. This facilitates moving
big-endian data to a little-endian system or vice-versa.
When the r pointer is non-NULL, the endian-swap occurs out-of-place, similar
to a block move. When the r pointer is NULL, the endian-swap occurs in-place,
allowing the swap to occur without using any additional storage.
This is the C equivalent of the assembly code without restrictions. Note that the
assembly code is hand optimized and restrictions may apply.
void DSP_blk_eswap16(void *x, void *r, int
{
int i;
char *_x, *_r;
if (r)
{
_x = (char *)x;
_r = (char *)r;
} else
{
_x = (char *)x;
_r = (char *)r;
}
for (i = 0; i < nx; i++)
{
char t0, t1;
t0 = _x[i*2 + 1];
t1 = _x[i*2 + 0];
_r[i*2 + 0] = t0;
_r[i*2 + 1] = t1;
}
}
nx)

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tms320c64x+

Table of Contents