Hi,
I am trying to do a "saturation" of a variable in C, both in the CLA and in the C28x (on a piccolo 28035), but I didn't find in C an efficient way to do it, that would use the "min" and "max" assembly and process the instructions quickly.
What I am doing now :
Variable = (Variable > MaxValue) ? MaxValue : Variable;
Variable = (Variable < MinValue) ? MinValue : Variable;
This is compiled as if/then, which is terrible for the pipeline.
Is there a way to do it efficiently, both in CLA and C28x ? (I need both, preferably in C).
Thank you very much in advance,
Adrien