TInteger
Arbitrary precision integer
Source
Integer.pas (44)
Description
All operations, including bitwise operations, behave as though executed on a 2's complement integer. Internally the value is stored by sign and magnitude with the first byte being the most significant and the last byte the least significant (Big endian). The most significant byte can never be zero, that is, the magnitude is always stored in the shortest possible way, without leading zeros.
Fields
Scope | Visibility | Type | Name | Description |
---|---|---|---|---|
Instance | private | TSign | FSign | |
Instance | private | TArray<TByte> | FMagnitude | |
Type | public | TInteger | Zero | |
Type | public | TInteger | One |
Methods
Scope | Visibility | Result | Name | Description |
---|---|---|---|---|
Instance | private | TArray<TByte> | AddMagnitude(Left: TArray<TByte>; Right: TArray<TByte>) | |
Instance | private | TInteger | SubtractMagnitude(Left: TArray<TByte>; Right: TArray<TByte>) | |
Instance | private | TArray<TByte> | MultiplyMagnitude(Left: TArray<TByte>; Right: TArray<TByte>) | |
Instance | private | TArray<TByte> | DivideMagnitude(Dividend: TArray<TByte>; Divisor: TArray<TByte>) | |
Instance | private | DivideAndRemainderMagnitude(Dividend: TArray<TByte>; Divisor: TArray<TByte>; Quotient: TArray<TByte>; Remainder: TArray<TByte>) | ||
Instance | private | TArray<TByte> | RemainderMagnitude(Dividend: TArray<TByte>; Divisor: TArray<TByte>) | |
Instance | private | TArray<TByte> | ModularExponentMagnitude(Base: TArray<TByte>; Exponent: TArray<TByte>; Modulus: TArray<TByte>) | |
Instance | private | TArray<TByte> | ModularInverseMagnitude(Value: TArray<TByte>; Modulus: TArray<TByte>) | |
Instance | private | TArray<TByte> | SquareMagnitude(Value: TArray<TByte>) | |
Instance | private | TArray<TByte> | GreatestCommonDivisorMagnitude(Left: TArray<TByte>; Right: TArray<TByte>) | |
Instance | private | TSign | CompareMagnitude(Left: TArray<TByte>; Right: TArray<TByte>) | |
Instance | private | SetZeroMagnitude() | ||
Instance | private | SetPositive64Magnitude(Value: TPositiveInteger64; SignificantByteCount: TPositiveInteger32) | ||
Instance | private | SetValue64(Value: TInteger64; SignificantByteCount: TPositiveInteger32) | ||
Instance | private | SetValuePositive64(Value: TPositiveInteger64; SignificantByteCount: TPositiveInteger32) | ||
Instance | private | TInteger64 | ToBoundedInteger(ByteCount: TInteger32) | |
Instance | private | TPositiveInteger64 | ToBoundedPositiveInteger(ByteCount: TInteger32) | |
Global | private | InitializeConstants() | ||
Global | private | TArray<TByte> | StripLeadingZeroBytes(Magnitude: TArray<TByte>) | |
Global | private | TArray<TByte> | MakePositive(TwosComplement: TArray<TByte>) | |
Global | public | TInteger | New(Sign: TSign; Magnitude: TArray<TByte>) | |
Global | public | TInteger | NewFromTwosComplement(TwosComplement: TArray<TByte>) | Constructs a TInteger from a big endian 2's complement representation |
Instance | public | TText | ToText() | |
Instance | public | TPositiveInteger32 | HashCode() | |
Instance | public | TInteger | Multiply(Value: TInteger) | |
Instance | public | TInteger | Add(Value: TInteger) | |
Instance | public | TInteger | Subtract(Value: TInteger) | |
Instance | public | TInteger | Divide(Divisor: TInteger) | |
Instance | public | DivideAndRemainder(Divisor: TInteger; Quotient: TInteger; Remainder: TInteger) | ||
Instance | public | TInteger | Modulo(Divisor: TInteger) | |
Instance | public | TInteger | Modulo2(Divisor: TInteger32) | |
Instance | public | TInteger | Remainder(Divisor: TInteger) | |
Instance | public | TInteger | ModularExponent(Exponent: TInteger; Modulus: TInteger) | |
Instance | public | TInteger | ModularExponent2(Exponent: TInteger; ModulusExponent: TInteger32) | |
Instance | public | TInteger | ModularInverse(Modulus: TInteger) | |
Instance | public | TInteger | GreatestCommonDivisor(Value: TInteger) | |
Instance | public | TInteger | MultiplyWithPowerOfTen(Exponent: TInteger32) | |
Instance | public | TSign | CompareTo(Value: TInteger) | |
Instance | public | TBoolean | TestBit(Index: TInteger32) | |
Instance | public | TInteger32 | GetLowestSetBit() | |
Instance | public | TInteger32 | BitLength() | Returns the minimum number of bits needed to store the 2's complement representation excluding the sign bit |
Instance | public | TInteger32 | OctetLength() | |
Instance | public | TInteger32 | GetByteCount() | Returns the minimum number of bytes needed to store the 2's complement representation including the sign bit |
Instance | public | TBoolean | IsZero() | |
Instance | public | TBoolean | IsPositive() | |
Instance | public | TBoolean | IsNegative() | |
Instance | public | TBoolean | IsOne() | |
Instance | public | TInteger | AbsoluteValue() | |
Instance | public | TByte | SignByte() | |
Instance | public | TByte | GetByte(Index: TInteger32) | |
Instance | public | TInteger32 | GetFirstNonZeroByteIndex() | Returns the index of the first non-zero byte working from least significant to most significant |
Instance | public | TInteger | RoundUpToPrecision(Precision: TInteger) | |
Instance | public | TInteger8 | ToInteger8() | |
Instance | public | TInteger16 | ToInteger16() | |
Instance | public | TInteger32 | ToInteger32() | |
Instance | public | TInteger64 | ToInteger64() | |
Instance | public | TPositiveInteger8 | ToPositiveInteger8() | |
Instance | public | TPositiveInteger64 | ToPositiveInteger16() | |
Instance | public | TPositiveInteger32 | ToPositiveInteger32() | |
Instance | public | TPositiveInteger64 | ToPositiveInteger64() | |
Instance | public | TFloatingPoint32 | ToFloatingPoint32() | |
Instance | public | TFloatingPoint64 | ToFloatingPoint64() | |
Instance | public | TArray<TByte> | ToTwosComplementBigEndian(ByteCount: TInteger32) | |
Instance | public | TArray<TByte> | ToTwosComplementLittleEndian(ByteCount: TInteger32) | |
Instance | public | TInteger | Coerce(SignType: TSignType; ByteCount: TInteger32) | Coerces a value to the specified byte count and sign type |
Global | public | TInteger | Implicit(Value: TInteger8) | |
Global | public | TInteger | Implicit(Value: TPositiveInteger8) | |
Global | public | TInteger | Implicit(Value: TInteger16) | |
Global | public | TInteger | Implicit(Value: TPositiveInteger16) | |
Global | public | TInteger | Implicit(Value: TInteger32) | |
Global | public | TInteger | Implicit(Value: TPositiveInteger32) | |
Global | public | TInteger | Implicit(Value: TInteger64) | |
Global | public | TInteger | Implicit(Value: TPositiveInteger64) | |
Global | public | TPositiveInteger8 | Implicit(Value: TInteger) | |
Global | public | TPositiveInteger16 | Implicit(Value: TInteger) | |
Global | public | TPositiveInteger32 | Implicit(Value: TInteger) | |
Global | public | TPositiveInteger64 | Implicit(Value: TInteger) | |
Global | public | TInteger8 | Implicit(Value: TInteger) | |
Global | public | TInteger16 | Implicit(Value: TInteger) | |
Global | public | TInteger32 | Implicit(Value: TInteger) | |
Global | public | TInteger64 | Implicit(Value: TInteger) | |
Global | public | TFloatingPoint32 | Implicit(Value: TInteger) | |
Global | public | TFloatingPoint64 | Implicit(Value: TInteger) | |
Global | public | TInteger | Add(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | Subtract(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | Multiply(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | IntDivide(Left: TInteger; Right: TInteger) | |
Global | public | TFloatingPoint64 | Divide(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | Modulus(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | LeftShift(Operand: TInteger; Count: TInteger32) | |
Global | public | TInteger | RightShift(Operand: TInteger; Count: TInteger32) | |
Global | public | TBoolean | Equal(Left: TInteger; Right: TInteger) | |
Global | public | TBoolean | NotEqual(Left: TInteger; Right: TInteger) | |
Global | public | TBoolean | GreaterThan(Left: TInteger; Right: TInteger) | |
Global | public | TBoolean | GreaterThanOrEqual(Left: TInteger; Right: TInteger) | |
Global | public | TBoolean | LessThan(Left: TInteger; Right: TInteger) | |
Global | public | TBoolean | LessThanOrEqual(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | Positive(Value: TInteger) | |
Global | public | TInteger | Negative(Value: TInteger) | |
Global | public | Create() | ||
Global | public | Destroy() | ||
Global | public | TInteger | Minimum(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | Maximum(Left: TInteger; Right: TInteger) | |
Global | public | TSign | Compare(Left: TInteger; Right: TInteger) | |
Global | public | TInteger | ReadLittleEndian(Stream: TInputStream; ByteCount: TInteger32; Signed: TBoolean) | |
Global | public | WriteLittleEndian(Stream: TOutputStream; ByteCount: TInteger32; Signed: TBoolean; Value: TInteger) | ||
Global | public | TInteger | ReadBigEndian(Stream: TInputStream; ByteCount: TInteger32; Signed: TBoolean) | |
Global | public | WriteBigEndian(Stream: TOutputStream; ByteCount: TInteger32; Signed: TBoolean; Value: TInteger) |