DSP_maxval
DSP_maxval | Maximum Value of Vector | |||
Function |
| short DSP_maxval (const short *x, int nx) |
| |
Arguments |
| x[nx] | Pointer to input vector of size nx. | |
|
| nx | Length of input data vector. Must be multiple of 8 and ≥32. | |
|
| return short | Maximum value of a vector. | |
Description |
| This routine finds the element with maximum value in the input vector and | ||
|
| returns that value. | ||
Algorithm |
| This is the C equivalent of the assembly code without restrictions. Note that | ||
|
| the assembly code is hand optimized and restrictions may apply. |
short DSP_maxval(short x[ ], int nx)
{
int i, max; max = −32768;
for (i = 0; i < nx; i++) if (x[i] > max)
max = x[i]; return max;
}
Special Requirements nx is a multiple of 8 and greater than or equal to 32.
Implementation Notes
| - Bank Conflicts: No bank conflicts occur. | |
| - Interruptibility: The code is | |
Benchmarks | Cycles | nx / 4 + 10 |
| Codesize | 116 bytes |