C# Class BooRunner.Tools.DigitHelper

Contains big integer uint[] digits utilitary methods.
Show file Open project: juanplopes/euler

Public Methods

Method Description
DigitsBlockCopy ( uint blockFrom, uint blockTo, uint count ) : void

Copies digits from one block to another.

GetMinMaxLengthObjects ( BigInteger int1, BigInteger int2, BigInteger &smallerInt, BigInteger &biggerInt ) : void

Determines BigInteger object with lower length.

GetRealDigitsLength ( uint digits, uint length ) : uint

Returns real length of digits array (excluding leading zeroes).

SetBlockDigits ( double block, uint blockLength, double value ) : void

Sets digits in given block to given value.

SetBlockDigits ( uint block, uint blockLength, uint value ) : void

Sets digits in given block to given value.

ToUInt32WithSign ( int value, uint &resultValue, bool &negative ) : void

Converts int value to uint digit and value sign.

ToUInt64WithSign ( long value, ulong &resultValue, bool &negative ) : void

Converts long value to ulong digit and value sign.

Method Details

DigitsBlockCopy() public static method

Copies digits from one block to another.
public static DigitsBlockCopy ( uint blockFrom, uint blockTo, uint count ) : void
blockFrom uint From block start pointer.
blockTo uint To block start pointer.
count uint Count of dwords to copy.
return void

GetMinMaxLengthObjects() public static method

Determines BigInteger object with lower length.
public static GetMinMaxLengthObjects ( BigInteger int1, BigInteger int2, BigInteger &smallerInt, BigInteger &biggerInt ) : void
int1 BigInteger First big integer.
int2 BigInteger Second big integer.
smallerInt BigInteger Resulting smaller big integer (by length only).
biggerInt BigInteger Resulting bigger big integer (by length only).
return void

GetRealDigitsLength() public static method

Returns real length of digits array (excluding leading zeroes).
public static GetRealDigitsLength ( uint digits, uint length ) : uint
digits uint Big ingeter digits.
length uint Initial big integers length.
return uint

SetBlockDigits() public static method

Sets digits in given block to given value.
public static SetBlockDigits ( double block, uint blockLength, double value ) : void
block double Block start pointer.
blockLength uint Block length.
value double Value to set.
return void

SetBlockDigits() public static method

Sets digits in given block to given value.
public static SetBlockDigits ( uint block, uint blockLength, uint value ) : void
block uint Block start pointer.
blockLength uint Block length.
value uint Value to set.
return void

ToUInt32WithSign() public static method

Converts int value to uint digit and value sign.
public static ToUInt32WithSign ( int value, uint &resultValue, bool &negative ) : void
value int Initial value.
resultValue uint Resulting unsigned part.
negative bool Resulting sign.
return void

ToUInt64WithSign() public static method

Converts long value to ulong digit and value sign.
public static ToUInt64WithSign ( long value, ulong &resultValue, bool &negative ) : void
value long Initial value.
resultValue ulong Resulting unsigned part.
negative bool Resulting sign.
return void