I need to implement a saturation function (similar to _IQsat) in the CLA for an unsigned long variable. It can be done with an if-then, but I've tried this, which is faster:
#define uint_Sat(Data, SatVal) Data = (uint32_t)( __mminf32( (float32)Data, (float32)SatVal) );
where Data and SatVal are the input data and saturation / clamp value. both are unsigned long variables.
I've tested this and it works, but am I missing something, or is there a dedicated intrinsic that will do what i want but I've overlooked.
Thanks in advance for any insight.