rtxBigNumber.h File Reference

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

int rtxAddBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *c, OSSIZE szC)
 Addition big numbers: a + b = c.
int rtxSubBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *c, OSSIZE szC)
 Substraction big numbers: a - b = c.
int rtxMulBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *c, OSSIZE szC)
 Multiplication big numbers: a * b = c.
int rtxDivRemBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *c, OSSIZE szC, OSOCTET *rem, OSSIZE szRem)
 Division big numbers with reminder: a / b = c.
int rtxDivBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *c, OSSIZE szC)
 Division big numbers: a / b = c.
int rtxModBigNum (const OSOCTET *a, OSSIZE szA, const OSOCTET *b, OSSIZE szB, OSOCTET *rem, OSSIZE szRem)
 Division by module big numbers: a % b = rem.
int rtxBigNumToStr (const OSOCTET *a, OSSIZE szA, char *str, OSSIZE szStr)
 Convert big number to string.
int rtxStrToBigNum (const char *str, OSOCTET *a, OSSIZE szA)
 Convert string to big number.

Detailed Description

Definition in file rtxBigNumber.h.


Function Documentation

int rtxAddBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  c,
OSSIZE  szC 
)

Addition big numbers: a + b = c.

Parameters:
a First addend.
szA Length of first addend in octets.
b Second addend.
szB Length of second addend in octets.
c Sum.
szC Length of sum buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxBigNumToStr ( const OSOCTET *  a,
OSSIZE  szA,
char *  str,
OSSIZE  szStr 
)

Convert big number to string.

Parameters:
a Number.
szA Length of number in octets.
str Result string.
szStr Length of string buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxDivBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  c,
OSSIZE  szC 
)

Division big numbers: a / b = c.

Parameters:
a Divident.
szA Length of divident in octets.
b Divisor.
szB Length of divisor in octets.
c Quotient.
szC Length of quotient buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxDivRemBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  c,
OSSIZE  szC,
OSOCTET *  rem,
OSSIZE  szRem 
)

Division big numbers with reminder: a / b = c.

Parameters:
a Divident.
szA Length of divident in octets.
b Divisor.
szB Length of divisor in octets.
c Quotient.
szC Length of quotient buffer in octets.
rem Reminder.
szRem Length of reminder buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxModBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  rem,
OSSIZE  szRem 
)

Division by module big numbers: a % b = rem.

Parameters:
a Divident.
szA Length of divident in octets.
b Divisor.
szB Length of divisor in octets.
rem Reminder.
szRem Length of reminder buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxMulBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  c,
OSSIZE  szC 
)

Multiplication big numbers: a * b = c.

Parameters:
a Multiplicand.
szA Length of multiplicand in octets.
b Multiplier.
szB Length of multiplier in octets.
c Product.
szC Length of product buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxStrToBigNum ( const char *  str,
OSOCTET *  a,
OSSIZE  szA 
)

Convert string to big number.

Parameters:
str Input null terminated string.
a Result number.
szA Length of number buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.
int rtxSubBigNum ( const OSOCTET *  a,
OSSIZE  szA,
const OSOCTET *  b,
OSSIZE  szB,
OSOCTET *  c,
OSSIZE  szC 
)

Substraction big numbers: a - b = c.

Parameters:
a Minuend.
szA Length of minuend in octets.
b Substrahend.
szB Length of substrahend in octets.
c Difference.
szC Length of difference buffer in octets.
Returns:
Status of the operation. Zero if successful; a negative status code if overflow.