-
首页
-
C4D R23.110 C++ SDK
#include <big_integer.h>
详细描述
This is the interface for the
BigInteger
data type. The data is reference-counted and a copy will automatically be created if a non-const function is called.
@MAXON_ANNOTATION{refclass=false}
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
Zero()
Returns a
BigInteger
value of zero.
-
返回
-
A
BigInteger
value of zero.
◆
One()
Returns a
BigInteger
value of one.
-
返回
-
A
BigInteger
value of one.
◆
MinusOne()
Returns a
BigInteger
value of minus one.
-
返回
-
A
BigInteger
value of minus one.
◆
Set()
[1/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[2/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[3/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[4/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[5/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[6/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[7/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
Set()
[8/10]
Sets the value of this
BigInteger
.
-
参数
-
-
返回
-
OK on success.
◆
SetRandom()
Assigns a random value to this
BigInteger
. The number is always positive.
-
参数
-
[in]
|
bitCount
|
The number of bits to set. This value must be greater than 0.
|
[in]
|
provider
|
A secure random provider that can be used with
SecureRandom
. If nullptr is passed an unsecure default provider is chosen.
|
-
返回
-
OK on success.
◆
SetRandomPrime()
Assigns a random prime number value to this
BigInteger
. The number is always positive, odd and the (bitCount - 1) bit will be set.
-
参数
-
[in]
|
bitCount
|
The number of bits to set. This value must be greater than 1.
|
[in]
|
certainty
|
The generated number is a prime number with a probability of 1-0.5**certainty. This parameter must be greater than 0. The execution time of this function raises with the certainty.
|
[in]
|
provider
|
A secure random provider that can be used with
SecureRandom
. If nullptr is passed an unsecure default provider is chosen.
|
-
返回
-
OK on success.
◆
Set()
[9/10]
Sets the value of this
BigInteger
.
-
参数
-
[in]
|
mem
|
A memory block that contains the new value in the specified format.
|
[in]
|
littleEndian
|
If this value is true, the parameter is treated as little-endian ("Intel format"), otherwise big-endian ("Motorola format").
|
-
返回
-
OK on success.
◆
Set()
[10/10]
Sets the value of this
BigInteger
.
-
参数
-
[in]
|
str
|
The new value, represented as a decimal string. The string may only contain decimal digits.
|
-
返回
-
OK on success.
◆
SetHex()
Sets the value of this
BigInteger
.
-
参数
-
[in]
|
str
|
The new value, represented as a hexadecimal string. The string may only contain hexadecimal digits.
|
-
返回
-
OK on success.
◆
IsEven()
Checks if the value is even.
-
返回
-
True if the value is even, false otherwise.
◆
IsOdd()
Checks if the value is odd.
-
返回
-
True if the value is odd, false otherwise.
◆
IsOne()
Checks if the value is one.
-
返回
-
True if the value is one, false otherwise.
◆
IsZero()
Checks if the value is zero.
-
返回
-
True if the value is zero, false otherwise.
◆
IsNegative()
Checks if the value is negative.
-
返回
-
True if the value is negative, false otherwise.
◆
IsPowerOfTwo()
Checks if the value is a power of 2.
-
返回
-
True if the value is a power of 2, false otherwise.
◆
IsProbablyPrime()
Checks if the number is probably prime. The result will be false if the value of this
BigInteger
is smaller than one.
-
参数
-
[in]
|
certainty
|
The certainty with which the number is checked for being a prime number. This parameter must be greater than 0.
|
-
返回
-
True if number is greater than zero and prime with a probability of 1-0.5**certainty.
◆
Sign()
Gets the sign.
-
返回
-
-1 if the number is negative, 0 if it is zero, 1 if it is positive.
◆
GetHighestNonSignBit()
Gets the highest bit position that is different than the sign bit. This is the position incremented by one for negative numbers.
-
返回
-
The bit position. The return value is -1 if the number is 0.
◆
GetLowestSetBit()
Gets the lowest bit position that is zero.
-
返回
-
The bit position. The return value is -1 if the number is 0.
◆
GetLowestClearedBit()
Gets the lowest bit position that is zero.
-
返回
-
The bit position. The return value is -1 if the number is -1.
◆
IsBitSet()
Checks if the bit at a certain position is set.
-
参数
-
[in]
|
bit
|
The bit position to set.
|
-
返回
-
True, if the bit is set, false otherwise.
◆
GetLowestBits8U()
Get the lowest 8 bits.
-
返回
-
The lowest 8 bits as an unsigned 8-bit integer.
◆
GetLowestBits8S()
Get the lowest 8 bits.
-
返回
-
The lowest 8 bits as an signed 8-bit integer.
◆
GetLowestBits16U()
Get the lowest 16 bits.
-
返回
-
The lowest 16 bits as an unsigned 16-bit integer.
◆
GetLowestBits16S()
Get the lowest 16 bits.
-
返回
-
The lowest 16 bits as an signed 16-bit integer.
◆
GetLowestBits32U()
Get the lowest 32 bits.
-
返回
-
The lowest 32 bits as an unsigned 32-bit integer.
◆
GetLowestBits32S()
Get the lowest 32 bits.
-
返回
-
The lowest 32 bits as an signed 32-bit integer.
◆
GetLowestBits64U()
Get the lowest 64 bits.
-
返回
-
The lowest 64 bits as an unsigned 64-bit integer.
◆
GetLowestBits64S()
Get the lowest 64 bits.
-
返回
-
The lowest 64 bits as an signed 64-bit integer.
◆
GetDataCopy()
Gets a copy of the internal data.
-
参数
-
[in]
|
littleEndian
|
If this value is true, the data is written in little-endian format, otherwise big-endian.
|
[out]
|
data
|
The
BaseArray
that will hold the data copy in the specified format.
|
-
返回
-
OK on success.
◆
Add()
Performs the add operation.
-
参数
-
[in]
|
b
|
The value to add to this.
|
◆
Sub()
Performs the subtract operation.
-
参数
-
[in]
|
b
|
The value to subtract to this.
|
◆
Inc()
Increments the value by one.
◆
Dec()
Decrements the value by one.
◆
Mul()
Performs the multiply operation.
-
参数
-
[in]
|
b
|
The value to multiply to this.
|
◆
Div()
Performs the divide operation.
-
参数
-
[in]
|
b
|
The value with which is this to divide. The result is 0, if b is 0 or if its absolute value is bigger than the absolute value of this.
|
◆
Mod()
Performs the modulo operation.
-
参数
-
[in]
|
b
|
The modulus. The result is 0, if b is 0.
|
◆
DivMod()
Performs the divide and modulo operation.
-
参数
-
[in]
|
b
|
The value with which is this to divide. The result is 0, if b is 0 or if its absolute value is bigger than the absolute value of this.
|
[out]
|
r
|
The remainder of the division will be stored in r. The value of r is undefined if b is 0.
|
◆
Pow()
Performs the power operation.
-
参数
-
[in]
|
b
|
Raises this to the power of b. The result will be 0 if b is negative.
|
◆
PowMod()
Performs the power operation and takes the result modulo mod.
-
参数
-
[in]
|
b
|
Raises this to the power of b. The result will be 0 if b is negative.
|
[in]
|
mod
|
The modulo value.
|
◆
GreatestCommonDivisor()
Calculates the greatest common divisor of this and b. Both values must be greater than zero, otherwise the value will remain unchanged.
-
参数
-
◆
MultiplicativeInverse()
Calculates the multiplicative inverse of this modulo m. This must be smaller than m. The new result of this will be greater or equal to zero and smaller than m.
-
参数
-
[in]
|
m
|
Another
BigInteger
. This value must be greater than zero.
|
-
返回
-
True, if there is a multiplicative inverse, false otherwise. The value of this is unchanged if there is no multiplicative inverse.
◆
LeftShift()
Performs the Left shift operation. If the number of bits to shift is less than 0 the bits are shifted right.
-
参数
-
[in]
|
s
|
The number of bits to shift.
|
◆
RightShift()
Performs the Right shift operation. If the number of bits to shift is less than 0 the bits are shifted left.
-
参数
-
[in]
|
s
|
The number of bits to shift.
|
◆
Negate()
Negates the value.
◆
SetBit()
Sets a bit in the integer.
-
参数
-
[in]
|
bit
|
The position of the bit which is to set.
|
◆
ClearBit()
Clears a bit in the integer.
-
参数
-
[in]
|
bit
|
The position of the bit which is to clear.
|
◆
ToggleBit()
Toggles a bit in the integer.
-
参数
-
[in]
|
bit
|
The position of the bit which is to toggle.
|
◆
Compare()
Compares this with another
BigInteger
值。
-
参数
-
[in]
|
arg2
|
The other
BigInteger
value to compare with.
|
-
返回
-
The comparison result.
◆
GetHashCode()
Returns the hash code of the object.
◆
ToString()
Returns a readable string of the content.
-
参数
-
[in]
|
formatStatement
|
Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
|
-
返回
-
The converted result.
◆
DescribeIO()
Describe all elements of this class for I/O operations.
-
参数
-
[in]
|
stream
|
The stream that is used to register the class members.
|
-
返回
-
OK on success.