[Issue 8011] BigInt ++ and -- do wrong thing on negative numbers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 1 23:57:43 PDT 2012


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



--- Comment #4 from Ary Borenszweig <ary at esperanto.org.ar> 2012-05-01 23:58:55 PDT ---
"sign" is already a boolean, so it's simpler to do:

// non-const unary operations
    BigInt opUnary(string op)() if (op=="++" || op=="--")
    {
        static if (op=="++")
        {
            data = BigUint.addOrSubInt(data, 1UL, sign, sign);
            return this;
        }
        else static if (op=="--")
        {
            data = BigUint.addOrSubInt(data, 1UL, !sign, sign);
            return this;
        }
    }

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


More information about the Digitalmars-d-bugs mailing list