AnsweredAssumed Answered

32 sum with saturation

Question asked by stanzani.marco on Jan 8, 2016
Latest reply on Jan 12, 2016 by stanzani.marco
hello forum
I am using a Cortex M0+ and I am looking for suggestions about handling saturation with 32 bit addition.I found this code in the web 
uint32_t sadd32(uint32_t a, uint32_t b)
{ return (a > (1<<32-1) - b) ? ((1<<32)-1) : a + b;}

which can probably  extended to int32_t (which puzzles me :) ). I am looking for possible suggestions about more efficient assembly implementation

thanks

Outcomes