www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17249] New: Make BigInt data visible (not modifiable!)

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 puremagic.com
          Reporter: paul.d.anderson 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

--
Mar 09