I use the IAR C compiler and I have this problem:
if ((x += y) >= 32767) x = 32767;
if ((x += y) <= -32768) x = -32768;
Note that x, y are signed integers.
In both cases I cannot limit x to respective limit value, because x overflows before each comparison.
I think that this most likely a generic C problem thats why I posted in this GCC forum.
Please is there any ideas to slve simply without using lengthy code (temporary registers etc).