'int' is enough for 'length' to migrate code from x86 to x64

FrankLike via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 21 05:10:56 PST 2014


> D already has them:
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/checkedint.d

Druntime's checkint.d  should be modify:

  uint subu(uint x, uint y, ref bool overflow)
{
     if (x < y)
       return y - x;
      else
       return x - y;
}

  ulong subu(ulong x, ulong y, ref bool overflow)
{
     if (x < y)
       return y - x;
      else
       return x - y;
}


Frank


More information about the Digitalmars-d mailing list