AnsweredAssumed Answered

How to deal with Integer Overflow?

Question asked by Eli Jim on Sep 3, 2014
Latest reply on Sep 3, 2014 by Andrew Neil
For evaluation purposes I got the STM32F0 discovery kit (STM32F030R8T6) with Cortex-M0, and I am using it with the IAR embedded workbench.
From the datasheet I know it has no FPU, which is what I need.

In my project, in my C program, if I want to use only uint32 variables,
can anyone tell me how to deal with the integer overflow when I go above the fixed-width, and avoid the wrap-around?

I know one solution might be saturation arithmetic, I wonder if there is a library for this.

Any other way?

Thanks
Eli Jim

Outcomes