Re:Catching Integer Overflows in C
by jensnockert on Tuesday August 02, 2011 @08:48AM
(#2836908)
Or use saturating arithmetic, loads of common processors have instructions for that.
[ Parent
| on HN ]
Re:Catching Integer Overflows in C
by tedunangst on Tuesday August 02, 2011 @01:37PM
(#2837956)
Yes, "don't use C" can solve lots of problems, but it doesn't solve them when using C.
x86 only has SIMD instructions for it, IIRC.
Re:Catching Integer Overflows in C
by onan_barbarian on Tuesday August 02, 2011 @09:03AM
(#2836946)
You do recall correctly.
Further, x86 only provides these SIMD operations on 8-bit and 16-bit quantities, not on 32-bit or 64-bit quantities (although all these types can be packed into a SIMD register and operated on with at least some operations; for example regular, non-saturating add).
SSE has a menagerie of non-orthogonal oddities, unfortunately; this is only one of them.