DSP_blk_eswap16
DSP_blk_eswap16 Endian-Swap a Block of 16-Bit Values
Function | void blk_eswap16(void * restrict x, void * restrict r, int | nx) | |
Arguments | x [nx] | Source data. Must be | |
| r [nx] | Destination array. Must be | |
| nx | Number of | |
Description | The data in the x[] array is endian swapped, meaning that the | ||
| bytes within each | ||
| |||
| When the r pointer is | ||
| to a block move. When the r pointer is NULL, the | ||
| allowing the swap to occur without using any additional storage. | ||
Algorithm | 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 | nx) | |
| { |
|
|
| 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;
}
}