http://d.puremagic.com/issues/show_bug.cgi?id=3738


Andrei Alexandrescu <and...@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|nob...@puremagic.com        |and...@metalanguage.com


--- Comment #4 from Andrei Alexandrescu <and...@metalanguage.com> 2010-01-24 
09:19:04 PST ---
Here's the modified version as I plan to commit:

    void popFront()
    {
        static if (m)
        {
            static if (is(UIntType == uint) && m == uint.max)
            {
                immutable ulong
                    x = (cast(ulong) a * _x + c),
                    v = x >> 32,
                    w = x & uint.max;
                immutable y = cast(uint)(v + w);
                _x = (y < v || y == uint.max) ? (y + 1) : y;
            }
            else static if (is(UIntType == uint) && m == int.max)
            {
                immutable ulong
                    x = (cast(ulong) a * _x + c),
                    v = x >> 31,
                    w = x & int.max;
                const uint y = cast(uint)(v + w);
                _x = (y >= int.max) ? ((y + 1) & int.max) : y;
            }
            else
            {
                _x = cast(UIntType) ((cast(ulong) a * _x + c) % m);
            }
        }
        else
        {
            _x = a * _x + c;
        }
    }

I changed formatting a bit and literals with symbolic constants. Unfortunately
unittests don't fail when I slightly change some constants :o|.

Looks good?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to