|
BigDigits
2.6.1
|
Interface to the BigDigits "bd" functions using BIGD objects with automatic memory allocation. More...
Typedefs | |
| typedef int(* | BD_RANDFUNC )(unsigned char *buf, size_t nbytes, const unsigned char *seed, size_t seedlen) |
| TYPEDEF for user-defined random byte generator function. More... | |
| typedef uint32_t | bdigit_t |
| A synonym for a single digit (DIGIT_T is not exposed) More... | |
Functions | |
| int | bdAdd (BIGD w, BIGD u, BIGD v) |
| Compute sum w = u + v. More... | |
| int | bdAdd_s (BIGD w, BIGD u, BIGD v) |
| Compute w = u + v without restrictions on overlap of bdAdd() More... | |
| void | bdAndBits (BIGD a, BIGD b, BIGD c) |
| Computes bitwise operation a = b AND c. More... | |
| size_t | bdBitLength (BIGD b) |
| Returns number of significant bits in b. More... | |
| int | bdCompare (BIGD a, BIGD b) |
Returns sign of (a-b) in {0,1,-1} More... | |
| int | bdCompare_ct (BIGD a, BIGD b) |
Returns sign of (a-b) as {-1,0,+1} using constant-time algorithm. More... | |
| const char * | bdCompileTime (void) |
| Returns a pointer to a static string containing the time of compilation. More... | |
| size_t | bdConvFromDecimal (BIGD b, const char *s) |
| Convert string of decimal characters into a BIGD object. More... | |
| size_t | bdConvFromHex (BIGD b, const char *s) |
| Convert string of hexadecimal characters into a BIGD object. More... | |
| size_t | bdConvFromOctets (BIGD b, const unsigned char *octets, size_t nbytes) |
| Converts a byte array into a BIGD object. More... | |
| size_t | bdConvToDecimal (BIGD b, char *s, size_t smax) |
| Convert BIGD object into a string of decimal characters. More... | |
| size_t | bdConvToHex (BIGD b, char *s, size_t smax) |
| Convert BIGD object into a string of hexadecimal characters. More... | |
| size_t | bdConvToOctets (BIGD b, unsigned char *octets, size_t nbytes) |
| Converts a BIGD into an array of bytes, in big-endian order. More... | |
| int | bdCubeRoot (BIGD s, BIGD x) |
| Computes integer cube root s = floor(cuberoot(x)) More... | |
| int | bdDecrement (BIGD a) |
| Sets a = a - 1. More... | |
| int | bdDivide (BIGD q, BIGD r, BIGD u, BIGD v) |
| Compute integer division of u by v such that u=qv+r. More... | |
| int | bdDivide_s (BIGD q, BIGD r, BIGD u, BIGD v) |
| Compute u div v without restrictions on overlap of bdDivide() More... | |
| void | bdFree (BIGD *bd) |
| Destroy BIGD object: zeroise contents and free allocated memory. More... | |
| void | bdFreeVars (BIGD *pb1,...) |
| Destroy a set of BIGD objects. More... | |
| int | bdGcd (BIGD g, BIGD x, BIGD y) |
| Computes g = gcd(x, y), the greatest common divisor of x and y. More... | |
| int | bdGeneratePrime (BIGD a, size_t nbits, size_t ntests, const unsigned char *seed, size_t seedlen, BD_RANDFUNC RandFunc) |
| Generate a prime number. More... | |
| int | bdGetBit (BIGD a, size_t ibit) |
| Returns value 1 or 0 of bit n of a (0..nbits-1) More... | |
| int | bdIncrement (BIGD a) |
| Sets a = a + 1. More... | |
| int | bdIsEqual (BIGD a, BIGD b) |
| Returns true (1) if a == b, else false (0) More... | |
| int | bdIsEqual_ct (BIGD a, BIGD b) |
| Returns true if a == b, else false, using constant-time algorithm. More... | |
| int | bdIsEven (BIGD a) |
| Returns true (1) if a is even, else false (0) More... | |
| int | bdIsOdd (BIGD a) |
| Returns true (1) if a is odd, else false (0) More... | |
| int | bdIsPrime (BIGD b, size_t ntests) |
Returns true (1) if b is probably prime. More... | |
| int | bdIsZero (BIGD a) |
| Returns true (1) if a is zero, else false (0) More... | |
| int | bdIsZero_ct (BIGD a) |
| Returns true if a is zero, else false, using constant-time algorithm. More... | |
| int | bdJacobi (BIGD a, BIGD n) |
| Returns the Jacobi symbol (a/n) = {-1, 0, +1}. More... | |
| void | bdModAdd (BIGD w, BIGD u, BIGD v, BIGD m) |
| Computes w = u + v (mod m) More... | |
| int | bdModExp (BIGD y, BIGD x, BIGD e, BIGD m) |
| Computes y = x^e mod m. More... | |
| int | bdModExp_ct (BIGD y, BIGD x, BIGD e, BIGD m) |
| Computes y = x^e mod m in constant time. More... | |
| void | bdModHalve (BIGD w, const BIGD u, const BIGD p) |
| Computes w = u/2 (mod p) for an odd prime p. More... | |
| int | bdModInv (BIGD x, BIGD a, BIGD m) |
Computes the inverse of a modulo m, x = a^{-1} mod m More... | |
| int | bdModMult (BIGD a, BIGD x, BIGD y, BIGD m) |
| Computes a = (x * y) mod m. More... | |
| void | bdModPowerOf2 (BIGD a, size_t L) |
| Computes a = a mod 2^L, ie clears all bits greater than L. More... | |
| int | bdModSqrt (BIGD x, BIGD a, BIGD p) |
Computes x = one square root of an integer a modulo an odd prime p More... | |
| int | bdModSquare (BIGD a, BIGD x, BIGD m) |
| Computes a = x^2 mod m. More... | |
| void | bdModSub (BIGD w, BIGD u, BIGD v, BIGD m) |
| Computes w = u - v (mod m) More... | |
| int | bdModulo (BIGD r, BIGD u, BIGD v) |
| Compute remainder r = u mod v. More... | |
| int | bdModulo_s (BIGD r, BIGD u, BIGD v) |
| Compute u mod v without restrictions on overlap of bdModulo() More... | |
| int | bdMultiply (BIGD w, BIGD u, BIGD v) |
| Compute product w = u * v. More... | |
| int | bdMultiply_s (BIGD w, BIGD u, BIGD v) |
| Compute w = u * v without restrictions on overlap of bdMultiply() More... | |
| BIGD | bdNew (void) |
| Create new BIGD object. More... | |
| void | bdNewVars (BIGD *pb1,...) |
| Create a set of BIGD objects. More... | |
| void | bdNotBits (BIGD a, BIGD b) |
| Computes bitwise a = NOT b. More... | |
| void | bdOrBits (BIGD a, BIGD b, BIGD c) |
| Computes bitwise operation a = b OR c. More... | |
| int | bdPower (BIGD y, BIGD g, unsigned short int n) |
| Computes y = g^n (up to available memory!) More... | |
| void | bdPrint (BIGD b, size_t flags) |
| Print b in hex format to stdout. More... | |
| void | bdPrintBits (const char *prefix, BIGD b, const char *suffix) |
| Print b in bit (0/1) format with optional prefix and suffix strings. More... | |
| void | bdPrintDecimal (const char *prefix, BIGD b, const char *suffix) |
| Print b in decimal format with optional prefix and suffix strings. More... | |
| void | bdPrintHex (const char *prefix, BIGD b, const char *suffix) |
| Print b in hex format with optional prefix and suffix strings. More... | |
| size_t | bdQuickRandBits (BIGD a, size_t nbits) |
Generate a quick-and-dirty random number a of bit length at most nbits using plain-old-rand. More... | |
| int | bdRabinMiller (BIGD b, size_t ntests) |
Returns true (1) if b is probably prime using just the Rabin-Miller test. More... | |
| int | bdRandomSeeded (BIGD a, size_t nbits, const unsigned char *seed, size_t seedlen, BD_RANDFUNC RandFunc) |
| Generate a random number nbits long using RandFunc. More... | |
| int | bdSetBit (BIGD a, size_t n, int value) |
| Set bit n of a (0..nbits-1) with value 1 or 0. More... | |
| int | bdSetEqual (BIGD a, BIGD b) |
| Sets a = b. More... | |
| size_t | bdSetRandTest (BIGD a, size_t ndigits) |
| Set a with a "random" value of random length up to ndigits long suitable for quick tests. More... | |
| int | bdSetShort (BIGD b, bdigit_t d) |
| Converts a single digit into a BIGD. More... | |
| int | bdSetZero (BIGD a) |
| Sets a = 0. More... | |
| void | bdShiftLeft (BIGD a, BIGD b, size_t n) |
| Computes a = b << n. More... | |
| void | bdShiftRight (BIGD a, BIGD b, size_t n) |
| Computes a = b >> n. More... | |
| int | bdShortAdd (BIGD w, BIGD u, bdigit_t d) |
| Computes w = u + d where d is a single digit. More... | |
| int | bdShortCmp (BIGD a, bdigit_t d) |
| Returns sign of (a-d) where d is a single digit. More... | |
| int | bdShortDiv (BIGD q, BIGD r, BIGD u, bdigit_t d) |
| Computes integer division of u by single digit d. More... | |
| int | bdShortIsEqual (BIGD a, bdigit_t d) |
| Returns true if a == d, else false, where d is a single digit. More... | |
| bdigit_t | bdShortMod (BIGD r, BIGD u, bdigit_t d) |
| Computes r = u mod d where d is a single digit. More... | |
| int | bdShortMult (BIGD w, BIGD u, bdigit_t d) |
| Computes w = u * d where d is a single digit. More... | |
| int | bdShortSub (BIGD w, BIGD u, bdigit_t d) |
| Computes w = u - d where d is a single digit. More... | |
| size_t | bdSizeof (BIGD b) |
| Returns number of significant digits in b. More... | |
| int | bdSqrt (BIGD s, BIGD x) |
| Computes integer square root s = floor(sqrt(x)) More... | |
| int | bdSquare (BIGD w, BIGD x) |
| Compute square w = x^2. More... | |
| int | bdSquare_s (BIGD s, BIGD x) |
| Compute s = x * x without restrictions on overlap of bdSquare() More... | |
| int | bdSubtract (BIGD w, BIGD u, BIGD v) |
| Compute difference w = u - v. More... | |
| int | bdSubtract_s (BIGD w, BIGD u, BIGD v) |
| Compute w = u - v without restrictions on overlap of bdSubtract() More... | |
| bdigit_t | bdToShort (BIGD b) |
| Returns the least significant digit in b. More... | |
| int | bdVersion (void) |
| Returns version number = major*1000+minor*100+release*10+PP_OPTIONS. More... | |
| void | bdXorBits (BIGD a, BIGD b, BIGD c) |
| Computes bitwise operation a = b XOR c. More... | |
Interface to the BigDigits "bd" functions using BIGD objects with automatic memory allocation.
int generally return 0 to denote success but some return True/False (1/0) or borrow (+1) or error (-1). Functions of type size_t (an unsigned int) return a length.b should be as follows: | typedef int(* BD_RANDFUNC)(unsigned char *buf, size_t nbytes, const unsigned char *seed, size_t seedlen) |
TYPEDEF for user-defined random byte generator function.
| typedef uint32_t bdigit_t |
A synonym for a single digit (DIGIT_T is not exposed)
| int bdAdd | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute sum w = u + v.
w and v must be separate variables. Use bdAdd_s() to avoid overlap restriction. | int bdAdd_s | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute w = u + v without restrictions on overlap of bdAdd()
| void bdAndBits | ( | BIGD | a, |
| BIGD | b, | ||
| BIGD | c | ||
| ) |
Computes bitwise operation a = b AND c.
| size_t bdBitLength | ( | BIGD | b | ) |
Returns number of significant bits in b.
| int bdCompare | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Returns sign of (a-b) in {0,1,-1}
| int bdCompare_ct | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Returns sign of (a-b) as {-1,0,+1} using constant-time algorithm.
| const char* bdCompileTime | ( | void | ) |
Returns a pointer to a static string containing the time of compilation.
| size_t bdConvFromDecimal | ( | BIGD | b, |
| const char * | s | ||
| ) |
Convert string of decimal characters into a BIGD object.
| [out] | b | To receive the result |
| [in] | s | Null-terminated string of decimal digits [0-9] |
| size_t bdConvFromHex | ( | BIGD | b, |
| const char * | s | ||
| ) |
Convert string of hexadecimal characters into a BIGD object.
| [out] | b | To receive the result |
| [in] | s | Null-terminated string of hex digits [0-9A-Fa-f] |
| size_t bdConvFromOctets | ( | BIGD | b, |
| const unsigned char * | octets, | ||
| size_t | nbytes | ||
| ) |
Converts a byte array into a BIGD object.
| [out] | b | To receive the result |
| [in] | octets | Pointer to array of bytes (octets) |
| [in] | nbytes | Number of bytes in sequence |
| size_t bdConvToDecimal | ( | BIGD | b, |
| char * | s, | ||
| size_t | smax | ||
| ) |
Convert BIGD object into a string of decimal characters.
| [in] | b | BIGD object to be converted |
| [out] | s | String buffer to receive output |
| [in] | smax | Size of buffer including the terminating zero |
s is NULL or smax is zero then just returns required number. | size_t bdConvToHex | ( | BIGD | b, |
| char * | s, | ||
| size_t | smax | ||
| ) |
Convert BIGD object into a string of hexadecimal characters.
| [in] | b | BIGD object to be converted |
| [out] | s | String buffer to receive output |
| [in] | smax | Size of buffer including the terminating zero |
s is NULL or smax is zero then just returns required number. | size_t bdConvToOctets | ( | BIGD | b, |
| unsigned char * | octets, | ||
| size_t | nbytes | ||
| ) |
Converts a BIGD into an array of bytes, in big-endian order.
| [in] | b | BIGD object to be converted |
| [out] | octets | Array of bytes (octets) to receive output |
| [in] | nbytes | Length of array to receive output |
octets is NULL or nbytes is zero then just returns required size (nsig). nbytes is larger than required, or will truncate from the left if it is too short.| int bdCubeRoot | ( | BIGD | s, |
| BIGD | x | ||
| ) |
Computes integer cube root s = floor(cuberoot(x))
| int bdDecrement | ( | BIGD | a | ) |
Sets a = a - 1.
| int bdDivide | ( | BIGD | q, |
| BIGD | r, | ||
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute integer division of u by v such that u=qv+r.
| [out] | q | To receive quotient = u div v |
| [out] | r | To receive remainder = u mod v |
| [in] | u | Dividend |
| [in] | v | Divisor |
q and r must be independent of u and v. Use bdDivide_s() to avoid overlap restriction. | int bdDivide_s | ( | BIGD | q, |
| BIGD | r, | ||
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute u div v without restrictions on overlap of bdDivide()
| void bdFree | ( | BIGD * | bd | ) |
Destroy BIGD object: zeroise contents and free allocated memory.
| void bdFreeVars | ( | BIGD * | pb1, |
| ... | |||
| ) |
Destroy a set of BIGD objects.
The bdFreeVars function call above is equivalent to
NULL | int bdGcd | ( | BIGD | g, |
| BIGD | x, | ||
| BIGD | y | ||
| ) |
Computes g = gcd(x, y), the greatest common divisor of x and y.
| int bdGeneratePrime | ( | BIGD | a, |
| size_t | nbits, | ||
| size_t | ntests, | ||
| const unsigned char * | seed, | ||
| size_t | seedlen, | ||
| BD_RANDFUNC | RandFunc | ||
| ) |
Generate a prime number.
| [out] | a | To receive the result |
| [in] | nbits | Maximum number of bits in number |
| [in] | ntests | Number of primality tests to carry out (recommended at least 80) |
| [in] | seed | Optional seed to add extra entropy |
| [in] | seedlen | Number of bytes in seed |
| [in] | RandFunc | User function to generate random bytes |
| int bdGetBit | ( | BIGD | a, |
| size_t | ibit | ||
| ) |
Returns value 1 or 0 of bit n of a (0..nbits-1)
| int bdIncrement | ( | BIGD | a | ) |
Sets a = a + 1.
| int bdIsEqual | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Returns true (1) if a == b, else false (0)
| int bdIsEqual_ct | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Returns true if a == b, else false, using constant-time algorithm.
| int bdIsEven | ( | BIGD | a | ) |
Returns true (1) if a is even, else false (0)
| int bdIsOdd | ( | BIGD | a | ) |
Returns true (1) if a is odd, else false (0)
| int bdIsPrime | ( | BIGD | b, |
| size_t | ntests | ||
| ) |
Returns true (1) if b is probably prime.
| [in] | b | Number to test |
| [in] | ntests | The count of Rabin-Miller primality tests to carry out (recommended at least 80) |
| int bdIsZero | ( | BIGD | a | ) |
Returns true (1) if a is zero, else false (0)
| int bdIsZero_ct | ( | BIGD | a | ) |
Returns true if a is zero, else false, using constant-time algorithm.
| int bdJacobi | ( | BIGD | a, |
| BIGD | n | ||
| ) |
Returns the Jacobi symbol (a/n) = {-1, 0, +1}.
| void bdModAdd | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v, | ||
| BIGD | m | ||
| ) |
Computes w = u + v (mod m)
[0, m-1]. The variables w and v must not overlap. | int bdModExp | ( | BIGD | y, |
| BIGD | x, | ||
| BIGD | e, | ||
| BIGD | m | ||
| ) |
Computes y = x^e mod m.
| int bdModExp_ct | ( | BIGD | y, |
| BIGD | x, | ||
| BIGD | e, | ||
| BIGD | m | ||
| ) |
Computes y = x^e mod m in constant time.
| void bdModHalve | ( | BIGD | w, |
| const BIGD | u, | ||
| const BIGD | p | ||
| ) |
Computes w = u/2 (mod p) for an odd prime p.
[0,p-1] | int bdModInv | ( | BIGD | x, |
| BIGD | a, | ||
| BIGD | m | ||
| ) |
Computes the inverse of a modulo m, x = a^{-1} mod m
| int bdModMult | ( | BIGD | a, |
| BIGD | x, | ||
| BIGD | y, | ||
| BIGD | m | ||
| ) |
Computes a = (x * y) mod m.
| void bdModPowerOf2 | ( | BIGD | a, |
| size_t | L | ||
| ) |
Computes a = a mod 2^L, ie clears all bits greater than L.
| int bdModSqrt | ( | BIGD | x, |
| BIGD | a, | ||
| BIGD | p | ||
| ) |
Computes x = one square root of an integer a modulo an odd prime p
| x | To receive the result |
| a | An integer expected to be a quadratic residue modulo p |
| p | An odd prime |
p - x. x. | int bdModSquare | ( | BIGD | a, |
| BIGD | x, | ||
| BIGD | m | ||
| ) |
Computes a = x^2 mod m.
| void bdModSub | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v, | ||
| BIGD | m | ||
| ) |
Computes w = u - v (mod m)
[0, m-1]. The variables w and v must not overlap. | int bdModulo | ( | BIGD | r, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute remainder r = u mod v.
r and u must be separate variables. Use bdModulo_s() to avoid overlap restriction. | int bdModulo_s | ( | BIGD | r, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute u mod v without restrictions on overlap of bdModulo()
| int bdMultiply | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute product w = u * v.
w and u must be separate variables. Use bdMultiply_s() to avoid overlap restriction. | int bdMultiply_s | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute w = u * v without restrictions on overlap of bdMultiply()
| BIGD bdNew | ( | void | ) |
Create new BIGD object.
| void bdNewVars | ( | BIGD * | pb1, |
| ... | |||
| ) |
Create a set of BIGD objects.
The bdNewVars function call above is equivalent to
NULL | void bdNotBits | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Computes bitwise a = NOT b.
| void bdOrBits | ( | BIGD | a, |
| BIGD | b, | ||
| BIGD | c | ||
| ) |
Computes bitwise operation a = b OR c.
| int bdPower | ( | BIGD | y, |
| BIGD | g, | ||
| unsigned short int | n | ||
| ) |
Computes y = g^n (up to available memory!)
n is not too large | void bdPrint | ( | BIGD | b, |
| size_t | flags | ||
| ) |
Print b in hex format to stdout.
| [in] | b | Number to print |
| [in] | flags | (see below) |
0 default display leading zeros but no newlineBD_PRINT_NL 0x1 append a newline after printingBD_PRINT_TRIM 0x2 trim leading zero digits | void bdPrintBits | ( | const char * | prefix, |
| BIGD | b, | ||
| const char * | suffix | ||
| ) |
Print b in bit (0/1) format with optional prefix and suffix strings.
| void bdPrintDecimal | ( | const char * | prefix, |
| BIGD | b, | ||
| const char * | suffix | ||
| ) |
Print b in decimal format with optional prefix and suffix strings.
| void bdPrintHex | ( | const char * | prefix, |
| BIGD | b, | ||
| const char * | suffix | ||
| ) |
Print b in hex format with optional prefix and suffix strings.
| size_t bdQuickRandBits | ( | BIGD | a, |
| size_t | nbits | ||
| ) |
Generate a quick-and-dirty random number a of bit length at most nbits using plain-old-rand.
| int bdRabinMiller | ( | BIGD | b, |
| size_t | ntests | ||
| ) |
Returns true (1) if b is probably prime using just the Rabin-Miller test.
| [in] | b | Number to test (b > 2) |
| [in] | ntests | The count of Rabin-Miller primality tests to carry out (recommended at least 80) |
| int bdRandomSeeded | ( | BIGD | a, |
| size_t | nbits, | ||
| const unsigned char * | seed, | ||
| size_t | seedlen, | ||
| BD_RANDFUNC | RandFunc | ||
| ) |
Generate a random number nbits long using RandFunc.
| [out] | a | To receive the result |
| [in] | nbits | Maximum number of bits in number |
| [in] | seed | Optional seed to add extra entropy |
| [in] | seedlen | Number of bytes in seed |
| [in] | RandFunc | User function to generate random bytes |
| int bdSetBit | ( | BIGD | a, |
| size_t | n, | ||
| int | value | ||
| ) |
Set bit n of a (0..nbits-1) with value 1 or 0.
| int bdSetEqual | ( | BIGD | a, |
| BIGD | b | ||
| ) |
Sets a = b.
| size_t bdSetRandTest | ( | BIGD | a, |
| size_t | ndigits | ||
| ) |
Set a with a "random" value of random length up to ndigits long suitable for quick tests.
| int bdSetShort | ( | BIGD | b, |
| bdigit_t | d | ||
| ) |
Converts a single digit into a BIGD.
| [out] | b | To receive the result |
| [in] | d | A single digit |
| int bdSetZero | ( | BIGD | a | ) |
Sets a = 0.
| void bdShiftLeft | ( | BIGD | a, |
| BIGD | b, | ||
| size_t | n | ||
| ) |
Computes a = b << n.
| void bdShiftRight | ( | BIGD | a, |
| BIGD | b, | ||
| size_t | n | ||
| ) |
Computes a = b >> n.
| int bdShortAdd | ( | BIGD | w, |
| BIGD | u, | ||
| bdigit_t | d | ||
| ) |
Computes w = u + d where d is a single digit.
| int bdShortCmp | ( | BIGD | a, |
| bdigit_t | d | ||
| ) |
Returns sign of (a-d) where d is a single digit.
| int bdShortDiv | ( | BIGD | q, |
| BIGD | r, | ||
| BIGD | u, | ||
| bdigit_t | d | ||
| ) |
Computes integer division of u by single digit d.
| [out] | q | To receive quotient = u div d |
| [out] | r | To receive remainder = u mod d |
| [in] | u | Dividend, a BIGD object |
| [in] | d | Divisor, a single digit |
r must be provided to receive the remainder. | int bdShortIsEqual | ( | BIGD | a, |
| bdigit_t | d | ||
| ) |
Returns true if a == d, else false, where d is a single digit.
| int bdShortMult | ( | BIGD | w, |
| BIGD | u, | ||
| bdigit_t | d | ||
| ) |
Computes w = u * d where d is a single digit.
| int bdShortSub | ( | BIGD | w, |
| BIGD | u, | ||
| bdigit_t | d | ||
| ) |
Computes w = u - d where d is a single digit.
| size_t bdSizeof | ( | BIGD | b | ) |
Returns number of significant digits in b.
| int bdSqrt | ( | BIGD | s, |
| BIGD | x | ||
| ) |
Computes integer square root s = floor(sqrt(x))
| int bdSquare | ( | BIGD | w, |
| BIGD | x | ||
| ) |
Compute square w = x^2.
w and x must be separate variables. Use bdSquare_s() to avoid overlap restriction. | int bdSquare_s | ( | BIGD | s, |
| BIGD | x | ||
| ) |
Compute s = x * x without restrictions on overlap of bdSquare()
| int bdSubtract | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute difference w = u - v.
w and v must be separate variables. Use bdSubtract_s() to avoid overlap restriction. | int bdSubtract_s | ( | BIGD | w, |
| BIGD | u, | ||
| BIGD | v | ||
| ) |
Compute w = u - v without restrictions on overlap of bdSubtract()
| bdigit_t bdToShort | ( | BIGD | b | ) |
Returns the least significant digit in b.
| int bdVersion | ( | void | ) |
Returns version number = major*1000+minor*100+release*10+PP_OPTIONS.
| void bdXorBits | ( | BIGD | a, |
| BIGD | b, | ||
| BIGD | c | ||
| ) |
Computes bitwise operation a = b XOR c.