[Issue 7013] New: Mutable interface for BigInts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 25 16:53:10 PST 2011


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

           Summary: Mutable interface for BigInts
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-11-25 16:52:13 PST ---
When multi-precision numbers become large or quite large, the time spent
managing their memory risk becoming an issue. To improve this situation the GNU
multiprecision integer library allows for mutable numbers, that allow in-place
modification.

There was a discussion about offering a mutable interface for the General
Multiprecision PYthon project (GMPY) numbers too (see "Mutability... but not
for now"):
http://gmpy.sourceforge.net/

So maybe it's useful to add a mutable interface to Phobos bigints. A simple way
to do it is to add a "mutable" attribute that supports just few in-place
operations like += -= *= /= ^^= &= |= (but not other operations like == that
don't need mutability, to keep the situation semantically more clean):

auto x = BigInt("...");
x.mutable += BigInt("...");

-- 
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