[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: detecting integer over/underflow
On Mar 4, 9:14pm, cryintothebluesky%googlemail.com@localhost (Sad Clouds)
-- Subject: 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?
There is no operation involved. I've also renamed __overflow to __type_fit
to indicate better what this does. It checks if value fits in type.
| What data types are going to be used 8, 16, 32 and 64-bit integers?
The types the machine supports. The only assumption is intmax_t and
that double can represent that.
Main Index |
Thread Index |