4 ms·
.... However, unless you use non portable intrinsics, you can't make the compiler use MMX. So in practice you get wrap on overflow. Worse, the compiler is enti
by pjc50 7y ago
.... However, unless you use non portable intrinsics, you can't make the compiler use MMX. So in practice you get wrap on overflow.
Worse, the compiler is entitled to use saturation arithmetic if you've assumed wrapping.
- gpderetta 7y agoYou can build portable libraries on top of nonportable primitives.
- jstanley 7y ago> Worse, the compiler is entitled to use saturation arithmetic if you've assumed wrapping. C89 (draft[1], because the actual spec is not public) section 3.1.2.5 states: > ... a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting unsigned integer type. So, unless I'm misunderstanding, the compiler is not entitled to use saturation arithmetic on unsigned integers. [1] http://port70.net/~nsz/c/c89/c89-draft.html http://port70.net/~nsz/c/c89/c89-draft.html
- ncmncm 7y agosigned and unsigned have different semantics. The compiler is allowed to do literally anything on signed overflow, including launching the missiles, and not running the program. Or both.