DSPF_sp_maxval
DSPF_sp_maxval
Function
Arguments
Description
Algorithm
Special Requirements
Implementation Notes
4-56
Maximum element of single-precision vector
float DSPF_sp_maxval (const float* x, int nx)
x
Pointer to input array.
nx
Number of inputs in the input array.
This routine finds out the maximum number in the input array. This code re-
turns the maximum value in the array.
This is the C equivalent of the assembly code. Note that the assembly code
is hand optimized and restrictions may apply.
float DSPF_sp_maxval(const float* x, int nx)
{
int i,index;
float max;
*((int *)&max) = 0xff800000;
for (i = 0; i < nx; i++)
if (x[i] > max)
{
max = x[i];
index = i;
}
return max;
}
nx should be multiple of 2 and ≥ 2.
-
-
x should be double-word aligned.
-
The loop is unrolled six times.
-
Six maximums are maintained in each iteration.
-
One of the maximums is calculated using SUBSP in place of CMPGTSP.
-
NAN (not a number in single-precision format) in the input are disre-
garded.
Need help?
Do you have a question about the TMS320C67 DSP Series and is the answer not in the manual?
Questions and answers