engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 友元 | 所有成员列表
TBigInt< NumBits, bSigned > 模板类 参考

n-bit integer. 更多...

#include <BigInt.h>

Public 成员函数

void Add (const BigInt &Other)
 Adds two integers.
 
void BitwiseAnd (const BigInt &Other)
 Bitwise 'and'
 
void BitwiseNot ()
 Bitwise 'not'
 
void BitwiseOr (const BigInt &Other)
 Bitwise 'or'
 
void Divide (const BigInt &Divisor)
 Divides two integers.
 
void DivideWithRemainder (const BigInt &Divisor, BigInt &Remainder)
 Divides two integers with remainder.
 
int32 GetBit (int32 BitIndex) const
 Returns a bit value as an integer value (0 or 1).
 
int32 GetHighestNonZeroBit () const
 Returns the index of the highest non-zero bit. 更多...
 
int32 GetHighestNonZeroWord () const
 Returns the index of the highest word that is not zero. 更多...
 
bool IsEqual (const BigInt &Other) const
 Checks if two integers are equal.
 
bool IsGreater (const BigInt &Other) const
 this > Other
 
bool IsGreaterOrEqual (const BigInt &Other) const
 this >= Other
 
bool IsGreaterThanZero () const
 this > 0
 
bool IsLess (const BigInt &Other) const
 this < Other
 
bool IsLessOrEqual (const BigInt &Other) const
 this <= Other
 
bool IsLessThanZero () const
 this < 0
 
bool IsNegative () const
 Checks if this integer is negative.
 
bool IsZero () const
 this == 0
 
void Modulo (const BigInt &Modulus)
 Performs modulo operation on this integer.
 
void Multiply (const BigInt &Factor)
 Multiplies two integers.
 
void MultiplyFast (const BigInt &Factor)
 Multiplies two positive integers.
 
void Negate ()
 Negates this integer. 更多...
 
TBigInt & operator= (int64 Other)
 Assignment operator for int64 values.
 
bool operator[] (int32 BitIndex) const
 Bit indexing operator
 
void Parse (const FString &Value)
 Parses a string representing a hex value
 
FORCEINLINE void Set (int64 Value)
 Initializes this big int with a 64 bit integer value. 更多...
 
void SetBit (int32 BitIndex, int32 Value)
 Sets a bit value.
 
void ShiftLeft (const int32 BitCount)
 Shift left by the specified amount of bits. 更多...
 
void ShiftLeftByOneInternal ()
 Shift left by 1 bit.
 
void ShiftLeftInternal (const int32 BitCount)
 Shift left by the specified amount of bits. 更多...
 
void ShiftRight (const int32 BitCount)
 Shift right by the specified amount of bits. 更多...
 
void ShiftRightByOneInternal ()
 Shift right by 1 bit.
 
void ShiftRightInternal (const int32 BitCount)
 Shift right by the specified amount of bits. 更多...
 
int32 Sign () const
 Returns the sign of this integer.
 
void Sqrt ()
 Calculates square root of this integer.
 
void Subtract (const BigInt &Other)
 Subtracts two integers.
 
 TBigInt ()
 Default constructor. 更多...
 
 TBigInt (const FString &Value)
 Constructor. 更多...
 
 TBigInt (const uint32 *InBits)
 Constructor. 更多...
 
 TBigInt (const uint8 *InData, uint32 InNumBytes)
 Constructor. 更多...
 
 TBigInt (int64 Other)
 Constructor. 更多...
 
int64 ToInt () const
 Returns the value of this big int as a 64-bit integer. 更多...
 
FString ToString () const
 Returns this big int as a string.
 
FORCEINLINE void Zero ()
 Sets this integer to 0.
 

友元

FArchive & operator<< (FArchive &Ar, BigInt &Value)
 Serialization.
 

详细描述

template<int32 NumBits, bool bSigned = true>
class TBigInt< NumBits, bSigned >

n-bit integer.

待办事项:
: optimize Data is stored as an array of 32-bit words from the least to the most significant Doesn't handle overflows (not a big issue, we can always use a bigger bit count) Minimum sanity checks. Can convert from int64 and back (by truncating the result, this is mostly for testing)

构造及析构函数说明

◆ TBigInt() [1/5]

template<int32 NumBits, bool bSigned = true>
TBigInt< NumBits, bSigned >::TBigInt ( )
inline

Default constructor.

Initializes the number to zero.

◆ TBigInt() [2/5]

template<int32 NumBits, bool bSigned = true>
TBigInt< NumBits, bSigned >::TBigInt ( int64  Other)
inline

Constructor.

Initializes this big int with a 64 bit integer value.

参数
OtherThe value to set.

◆ TBigInt() [3/5]

template<int32 NumBits, bool bSigned = true>
TBigInt< NumBits, bSigned >::TBigInt ( const uint32 *  InBits)
inlineexplicit

Constructor.

Initializes this big int with an array of words.

◆ TBigInt() [4/5]

template<int32 NumBits, bool bSigned = true>
TBigInt< NumBits, bSigned >::TBigInt ( const uint8 *  InData,
uint32  InNumBytes 
)
inlineexplicit

Constructor.

Initializes this big int with an array of bytes.

◆ TBigInt() [5/5]

template<int32 NumBits, bool bSigned = true>
TBigInt< NumBits, bSigned >::TBigInt ( const FString &  Value)
inlineexplicit

Constructor.

Initializes this big int with a string representing a hex value.

成员函数说明

◆ GetHighestNonZeroBit()

template<int32 NumBits, bool bSigned = true>
int32 TBigInt< NumBits, bSigned >::GetHighestNonZeroBit ( ) const
inline

Returns the index of the highest non-zero bit.

-1 if no such bit exists.

◆ GetHighestNonZeroWord()

template<int32 NumBits, bool bSigned = true>
int32 TBigInt< NumBits, bSigned >::GetHighestNonZeroWord ( ) const
inline

Returns the index of the highest word that is not zero.

-1 if no such word exists.

◆ Negate()

template<int32 NumBits, bool bSigned = true>
void TBigInt< NumBits, bSigned >::Negate ( )
inline

Negates this integer.

value = -value

◆ Set()

template<int32 NumBits, bool bSigned = true>
FORCEINLINE void TBigInt< NumBits, bSigned >::Set ( int64  Value)
inline

Initializes this big int with a 64 bit integer value.

参数
ValueThe value to set.

◆ ShiftLeft()

template<int32 NumBits, bool bSigned = true>
void TBigInt< NumBits, bSigned >::ShiftLeft ( const int32  BitCount)
inline

Shift left by the specified amount of bits.

参数
BitCountthe number of bits to shift.

◆ ShiftLeftInternal()

template<int32 NumBits, bool bSigned = true>
void TBigInt< NumBits, bSigned >::ShiftLeftInternal ( const int32  BitCount)
inline

Shift left by the specified amount of bits.

Does not check if BitCount is valid.

参数
BitCountthe number of bits to shift.

◆ ShiftRight()

template<int32 NumBits, bool bSigned = true>
void TBigInt< NumBits, bSigned >::ShiftRight ( const int32  BitCount)
inline

Shift right by the specified amount of bits.

参数
BitCountthe number of bits to shift.

◆ ShiftRightInternal()

template<int32 NumBits, bool bSigned = true>
void TBigInt< NumBits, bSigned >::ShiftRightInternal ( const int32  BitCount)
inline

Shift right by the specified amount of bits.

Does not check if BitCount is valid.

参数
BitCountthe number of bits to shift.

◆ ToInt()

template<int32 NumBits, bool bSigned = true>
int64 TBigInt< NumBits, bSigned >::ToInt ( ) const
inline

Returns the value of this big int as a 64-bit integer.

If the value is greater, the higher bits are truncated.


该类的文档由以下文件生成: