tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: detecting integer over/underflow



On Sun, 4 Mar 2012 14:37:31 -0500
christos%zoulas.com@localhost (Christos Zoulas) wrote:

> Hello,
> 
> Currently it is not easy to detect if a value will fit into a type
> so I wrote the following macros to simplify this.
> 
> Basically we have:
> 
>       __overflow(type, value)
> 
> That returns false if value fits in type, and true if not. If anyone
> knows of a simpler way of doing this, I am all ears :-)

What arithmetic operations are you trying to support - addition,
subtraction, multiplication?

What data types are going to be used 8, 16, 32 and 64-bit integers?


Home | Main Index | Thread Index | Old Index