C# Class IntXLib.OpHelper

Contains helping methods for operations over IntX.
ファイルを表示 Open project: devoyster/IntXLib

Public Methods

Method Description
Add ( IntX int1, IntX int2 ) : IntX

Adds two big integers.

AddSub ( IntX int1, IntX int2, bool subtract ) : IntX

Adds/subtracts one IntX to/from another. Determines which operation to use basing on operands signs.

BitwiseAnd ( IntX int1, IntX int2 ) : IntX

Performs bitwise AND for two big integers.

BitwiseOr ( IntX int1, IntX int2 ) : IntX

Performs bitwise OR for two big integers.

Cmp ( IntX int1, IntX int2, bool throwNullException ) : int

Compares 2 IntX objects. Returns "-2" if any argument is null, "-1" if int1 < int2, "0" if equal and "1" if >.

Cmp ( IntX int1, int int2 ) : int

Compares IntX object to int. Returns "-1" if int1 < int2, "0" if equal and "1" if >.

Cmp ( IntX int1, uint int2 ) : int

Compares IntX object to unsigned int. Returns "-1" if int1 < int2, "0" if equal and "1" if >. For internal use.

ExclusiveOr ( IntX int1, IntX int2 ) : IntX

Performs bitwise XOR for two big integers.

OnesComplement ( IntX value ) : IntX

Performs bitwise NOT for big integer.

Pow ( IntX value, uint power, MultiplyMode multiplyMode ) : IntX

Returns a specified big integer raised to the specified power.

Sh ( IntX intX, long shift, bool toLeft ) : IntX

Shifts IntX object. Determines which operation to use basing on shift sign.

Sub ( IntX int1, IntX int2 ) : IntX

Subtracts two big integers.

Method Details

Add() public static method

Adds two big integers.
or is too big for add operation.
public static Add ( IntX int1, IntX int2 ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
return IntX

AddSub() public static method

Adds/subtracts one IntX to/from another. Determines which operation to use basing on operands signs.
or is a null reference.
public static AddSub ( IntX int1, IntX int2, bool subtract ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
subtract bool Was subtraction initially.
return IntX

BitwiseAnd() public static method

Performs bitwise AND for two big integers.
public static BitwiseAnd ( IntX int1, IntX int2 ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
return IntX

BitwiseOr() public static method

Performs bitwise OR for two big integers.
public static BitwiseOr ( IntX int1, IntX int2 ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
return IntX

Cmp() public static method

Compares 2 IntX objects. Returns "-2" if any argument is null, "-1" if int1 < int2, "0" if equal and "1" if >.
or is a null reference and is set to true.
public static Cmp ( IntX int1, IntX int2, bool throwNullException ) : int
int1 IntX First big integer.
int2 IntX Second big integer.
throwNullException bool Raises or not .
return int

Cmp() public static method

Compares IntX object to int. Returns "-1" if int1 < int2, "0" if equal and "1" if >.
public static Cmp ( IntX int1, int int2 ) : int
int1 IntX First big integer.
int2 int Second integer.
return int

Cmp() public static method

Compares IntX object to unsigned int. Returns "-1" if int1 < int2, "0" if equal and "1" if >. For internal use.
public static Cmp ( IntX int1, uint int2 ) : int
int1 IntX First big integer.
int2 uint Second unsigned integer.
return int

ExclusiveOr() public static method

Performs bitwise XOR for two big integers.
public static ExclusiveOr ( IntX int1, IntX int2 ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
return IntX

OnesComplement() public static method

Performs bitwise NOT for big integer.
public static OnesComplement ( IntX value ) : IntX
value IntX Big integer.
return IntX

Pow() public static method

Returns a specified big integer raised to the specified power.
is a null reference.
public static Pow ( IntX value, uint power, MultiplyMode multiplyMode ) : IntX
value IntX Number to raise.
power uint Power.
multiplyMode MultiplyMode Multiply mode set explicitly.
return IntX

Sh() public static method

Shifts IntX object. Determines which operation to use basing on shift sign.
is a null reference.
public static Sh ( IntX intX, long shift, bool toLeft ) : IntX
intX IntX Big integer.
shift long Bits count to shift.
toLeft bool If true the shifting to the left.
return IntX

Sub() public static method

Subtracts two big integers.
public static Sub ( IntX int1, IntX int2 ) : IntX
int1 IntX First big integer.
int2 IntX Second big integer.
return IntX