On Tuesday, 23 May 2017 at 15:43:24 UTC, Andrei Alexandrescu wrote:
On 05/23/2017 11:37 AM, Stefan Koch wrote:

The compiler does indeed seem to optimize the code somewhat.
Although the generated asm still looks wired.

That call enters a different overload:

pragma(inline, true)
uint mulu(uint x, uint y, ref bool overflow)
    ulong r = ulong(x) * ulong(y);
    if (r > uint.max)
        overflow = true;
    return cast(uint)r;

which is of efficiency comparable with code using seto. I'm not too worried about that. https://goo.gl/eRXUpr is of interest.


Well ....
Since core.checkedint is in druntime, we _could_ detected the checking operations and generate better code for them.
But right now, I am convinced it is worth the effort.

Reply via email to