This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to check overflow

Hi 8051 Gurus,
The question i have is general C question and not specific to any chip.
I have two variables of long type, which is the maximum storage size supported. I want to know whether it will cause an overflow while multiplying these two variables or not. I dont want to use any assembly code as i said this is not specific to chip. E.g.

long a, b, c;
c = a * b;

Anyone can help me. Also i donw want to use multibyte maths which will be again processor specific...!!

Thanks in Advance...!!

0