[Issue 17249] New: Make BigInt data visible (not modifiable!)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Mar 9 15:16:05 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17249

          Issue ID: 17249
           Summary: Make BigInt data visible (not modifiable!)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: paul.d.anderson at comcast.net

Determining the number of decimal digits in a BigInt requires examination of
the ulong/uint data. It would be useful to have a straightforward method of
doing so. 

I recommend making the std.internal.math.biguintcore functions peekUlong and
peekUint visible at the std.bigint level by adding the following functions to
std.bigint:

ulong ulongDigit(int n) pure nothrow const @safe @nogc
{
  return data.peekUlong(n);
}

uint uintDigit(int n) pure nothrow const @safe @nogc
{
  return data.peekUint(n);
}

I've readied a pull request to add these functions to std.bigint

--


More information about the Digitalmars-d-bugs mailing list