Tool/software: TI C/C++ Compiler
I have read the C28x Optimising Compiler guide (spru514k) and have not determined the best method (i.e. least cycles) for performing saturating arithmetic in C.
Table 7-6 provides the list of intrinsics available in the compiler. Of interest is the __sat intrinsics that would allow me to saturate an arithmetic result based on the OVC bits. But the intrinsics do not provide a method for explicitly performing arithmetic operations that increment/decrement the OVC bits.
I realise I could test for overflow using C but this requires a complex conditional evaluation for the bounds.
Please could you provide a sample of C code that performs saturating arithmetic that is performant.