XBinder
Version 2.9.x
|
#include "rtxsrc/rtxContext.h"
Go to the source code of this file.
Functions | |
EXTERNRT void | rtxBigIntInit (OSBigInt *pInt) |
This function initializes a big integer structure. More... | |
EXTERNRT int | rtxBigIntEnsureCapacity (OSCTXT *pctxt, OSBigInt *pInt, OSSIZE capacity) |
This function ensures that the big integer has capacity to hold at least the given number of bytes. More... | |
EXTERNRT int | rtxBigIntSetStr (OSCTXT *pctxt, OSBigInt *pInt, const char *value, int radix) |
This function sets a big integer binary value from a null-terminated string. More... | |
EXTERNRT int | rtxBigIntSetStrn (OSCTXT *pctxt, OSBigInt *pInt, const char *value, OSSIZE len, int radix) |
This function sets a big integer binary value from a character string using the given number of characters. More... | |
EXTERNRT int | rtxBigIntSetInt64 (OSCTXT *pctxt, OSBigInt *pInt, OSINT64 value) |
This function sets a big integer binary value from a signed 64-bit integer value. More... | |
EXTERNRT int | rtxBigIntSetUInt64 (OSCTXT *pctxt, OSBigInt *pInt, OSUINT64 value) |
This function sets a big integer binary value from an unsigned 64-bit integer value. More... | |
EXTERNRT int | rtxBigIntSetBytesSigned (OSCTXT *pctxt, OSBigInt *pInt, OSOCTET *value, OSSIZE vallen) |
This function sets a big integer binary value from a byte array. More... | |
EXTERNRT int | rtxBigIntSetBytesUnsigned (OSCTXT *pctxt, OSBigInt *pInt, OSOCTET *value, OSSIZE vallen) |
This function sets a big integer binary value from a byte array. More... | |
EXTERNRT OSSIZE | rtxBigIntGetDataLen (const OSBigInt *pInt) |
This function is used to get the size in bytes of the binary big integer data value. More... | |
EXTERNRT int | rtxBigIntGetData (OSCTXT *pctxt, const OSBigInt *pInt, OSOCTET *buffer, OSSIZE bufSize) |
This function is used to get the binary big integer data value in a byte array. More... | |
EXTERNRT OSSIZE | rtxBigIntDigitsNum (const OSBigInt *pInt, int radix) |
This function is used to get the number of digits in the binary big integer data value based on radix. More... | |
EXTERNRT int | rtxBigIntCopy (OSCTXT *pctxt, const OSBigInt *pSrc, OSBigInt *pDst) |
This function is used to copy a big integer data value from one structure to another. More... | |
EXTERNRT int | rtxBigIntFastCopy (OSCTXT *pctxt, const OSBigInt *pSrc, OSBigInt *pDst) |
This function is used to copy one BigInt to another. More... | |
EXTERNRT OSBOOL | rtxBigIntToReal (const OSBigInt *pSrc, OSREAL *pvalue) |
This function converts the given big integer to a real, if it will fit without requiring rounding (i.e. More... | |
EXTERNRT int | rtxBigIntToString (OSCTXT *pctxt, const OSBigInt *pInt, int radix, char *str, OSSIZE strSize) |
This function is used to convert a binary big integer value to a string. More... | |
EXTERNRT char * | rtxBigIntToDynStr (OSCTXT *pctxt, const OSBigInt *pInt, int radix) |
This function is used to convert a binary big integer value to a dynamic string. More... | |
EXTERNRT int | rtxBigIntPrint (const OSUTF8CHAR *name, const OSBigInt *bigint, int radix) |
This function is used to print a big integer value to standard output. More... | |
EXTERNRT int | rtxBigIntCompare (const OSBigInt *arg1, const OSBigInt *arg2) |
This function is used to compare two big integer values. More... | |
EXTERNRT int | rtxBigIntStrCompare (OSCTXT *pctxt, const char *arg1, const char *arg2) |
This function is used to compare two big integer numeric strings. More... | |
EXTERNRT void | rtxBigIntFree (OSCTXT *pctxt, OSBigInt *pInt) |
This function frees internal memory within the big integer structure. More... | |
EXTERNRT int | rtxBigIntAdd (OSCTXT *pctxt, OSBigInt *result, const OSBigInt *arg1, const OSBigInt *arg2) |
This function is used to add two big integer values. More... | |
EXTERNRT int | rtxBigIntSubtract (OSCTXT *pctxt, OSBigInt *result, const OSBigInt *arg1, const OSBigInt *arg2) |
This function is used to subtract one big integer value from another. More... | |
EXTERNRT int | rtxBigIntMultiply (OSCTXT *pctxt, OSBigInt *result, const OSBigInt *arg1, const OSBigInt *arg2) |
This function is used to multiply two big integer values. More... | |
EXTERN OSSIZE | rtxBase2DigitsToRadix (OSUINT8 radix, OSSIZE n) |
Return the number of radix digits that may be required to represent an integer having n base 2 digits (assuming the base 2 number is unsigned). More... | |
EXTERN OSSIZE | rtxRadixDigitsToBase2 (OSUINT8 radix, OSSIZE n) |
Return the number of base 2 digits that may be required to represent an integer having n radix digits (assuming the base 2 number is unsigned). More... | |
EXTERNRT unsigned short | rtxBigIntBitsPerDigit (int halfRadix) |
For internal use only. More... | |
EXTERN OSSIZE rtxBase2DigitsToRadix | ( | OSUINT8 | radix, |
OSSIZE | n | ||
) |
Return the number of radix digits that may be required to represent an integer having n base 2 digits (assuming the base 2 number is unsigned).
This may return a larger value than the actual value.
radix | 8, 10, or 16 |
n | Number of base 2 digits; n > 0. |
EXTERNRT int rtxBigIntAdd | ( | OSCTXT * | pctxt, |
OSBigInt * | result, | ||
const OSBigInt * | arg1, | ||
const OSBigInt * | arg2 | ||
) |
This function is used to add two big integer values.
pctxt | Pointer to a context structure. |
result | Pointer to big integer structure to receive result. Must have been initialized using rtxBigIntInit. |
arg1 | First big integer to add. |
arg2 | Second big integer to add. |
EXTERNRT unsigned short rtxBigIntBitsPerDigit | ( | int | halfRadix | ) |
For internal use only.
The name is misleading. Documentation is in the .c file. Consider instead rtxRadixDigitsToBase2.
EXTERNRT int rtxBigIntCompare | ( | const OSBigInt * | arg1, |
const OSBigInt * | arg2 | ||
) |
This function is used to compare two big integer values.
arg1 | First big integer to compare. |
arg2 | Second big integer to compare. |
EXTERNRT int rtxBigIntCopy | ( | OSCTXT * | pctxt, |
const OSBigInt * | pSrc, | ||
OSBigInt * | pDst | ||
) |
This function is used to copy a big integer data value from one structure to another.
pctxt | Pointer to a context structure. |
pSrc | Pointer to source big integer structure. |
pDst | Pointer to destination big integer structure. |
EXTERNRT OSSIZE rtxBigIntDigitsNum | ( | const OSBigInt * | pInt, |
int | radix | ||
) |
This function is used to get the number of digits in the binary big integer data value based on radix.
pInt | Pointer to big integer structure. |
radix | Radix of the string value, Valid values are 2, 8, 10, or 16. |
EXTERNRT int rtxBigIntEnsureCapacity | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
OSSIZE | capacity | ||
) |
This function ensures that the big integer has capacity to hold at least the given number of bytes.
This can be used prior to directly copying bytes into mag. POST: On a successful return, pInt->allocated <= capacity; pInt->dynamic might now be TRUE. The value of the big integer is unchanged.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure. |
capacity | Required capacity. |
EXTERNRT int rtxBigIntFastCopy | ( | OSCTXT * | pctxt, |
const OSBigInt * | pSrc, | ||
OSBigInt * | pDst | ||
) |
This function is used to copy one BigInt to another.
This function will not allocate memory for the byte buffer if the destination BigInt already has a large enough allocated array to hold the data. The destination BigInt must have been initialized using the rtxBigIntInit function.
pctxt | Pointer to a context structure. |
pSrc | Pointer to source big integer structure. |
pDst | Pointer to destination big integer structure. |
EXTERNRT void rtxBigIntFree | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt | ||
) |
This function frees internal memory within the big integer structure.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure in which memory is to be freed. |
EXTERNRT int rtxBigIntGetData | ( | OSCTXT * | pctxt, |
const OSBigInt * | pInt, | ||
OSOCTET * | buffer, | ||
OSSIZE | bufSize | ||
) |
This function is used to get the binary big integer data value in a byte array.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure. |
buffer | Buffer into which binary big integer value is to be copied. |
bufSize | Size of the data buffer. |
EXTERNRT OSSIZE rtxBigIntGetDataLen | ( | const OSBigInt * | pInt | ) |
This function is used to get the size in bytes of the binary big integer data value.
pInt | Pointer to big integer structure. |
EXTERNRT void rtxBigIntInit | ( | OSBigInt * | pInt | ) |
This function initializes a big integer structure.
It must be called prior to working with the structure.
pInt | Pointer to big integer data structure. |
EXTERNRT int rtxBigIntMultiply | ( | OSCTXT * | pctxt, |
OSBigInt * | result, | ||
const OSBigInt * | arg1, | ||
const OSBigInt * | arg2 | ||
) |
This function is used to multiply two big integer values.
pctxt | Pointer to a context structure. |
result | Pointer to big integer structure to receive result. |
arg1 | First big integer to be multiplied. |
arg2 | Second big integer to be multiplied. |
EXTERNRT int rtxBigIntPrint | ( | const OSUTF8CHAR * | name, |
const OSBigInt * | bigint, | ||
int | radix | ||
) |
This function is used to print a big integer value to standard output.
name | Name to print in "name=value" format. |
bigint | Pointer to big integer value to be printed. |
radix | Radix of the string value, Valid values are 2, 8, 10, or 16. |
EXTERNRT int rtxBigIntSetBytesSigned | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
OSOCTET * | value, | ||
OSSIZE | vallen | ||
) |
This function sets a big integer binary value from a byte array.
The array is assumed to hold the value in 2's complement form.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | Buffer containing binary integer value in 2's complement form. |
vallen | Number of byte in the value buffer. |
EXTERNRT int rtxBigIntSetBytesUnsigned | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
OSOCTET * | value, | ||
OSSIZE | vallen | ||
) |
This function sets a big integer binary value from a byte array.
The array is assumed to hold the value in unsigned form.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | Buffer containing binary unsigned integer value. |
vallen | Number of byte in the value buffer. |
EXTERNRT int rtxBigIntSetInt64 | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
OSINT64 | value | ||
) |
This function sets a big integer binary value from a signed 64-bit integer value.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | 64-bit integer value to convert. |
EXTERNRT int rtxBigIntSetStr | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
const char * | value, | ||
int | radix | ||
) |
This function sets a big integer binary value from a null-terminated string.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | Numeric string to convert. |
radix | Radix of the string value, Valid values are 0, 2, 8, 10, or 16. Zero must be used if string contains a prefix that identifies the radix (for example, 0x). |
EXTERNRT int rtxBigIntSetStrn | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
const char * | value, | ||
OSSIZE | len, | ||
int | radix | ||
) |
This function sets a big integer binary value from a character string using the given number of characters.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | Numeric string to convert. |
len | Number of bytes from character string to use. |
radix | Radix of the string value, Valid values are 0, 2, 8, 10, or 16. Zero must be used if string contains a prefix that identifies the radix (for example, 0x). |
EXTERNRT int rtxBigIntSetUInt64 | ( | OSCTXT * | pctxt, |
OSBigInt * | pInt, | ||
OSUINT64 | value | ||
) |
This function sets a big integer binary value from an unsigned 64-bit integer value.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to receive converted value. |
value | 64-bit integer value to convert. |
EXTERNRT int rtxBigIntStrCompare | ( | OSCTXT * | pctxt, |
const char * | arg1, | ||
const char * | arg2 | ||
) |
This function is used to compare two big integer numeric strings.
pctxt | Pointer to a context structure. |
arg1 | First big integer string to compare. |
arg2 | Second big integer string to compare. |
EXTERNRT int rtxBigIntSubtract | ( | OSCTXT * | pctxt, |
OSBigInt * | result, | ||
const OSBigInt * | arg1, | ||
const OSBigInt * | arg2 | ||
) |
This function is used to subtract one big integer value from another.
pctxt | Pointer to a context structure. |
result | Pointer to big integer structure to receive result. |
arg1 | Big integer value that arg2 is subtracted from (minuend). |
arg2 | Big integer to be subtracted from arg1 (subtrahend). |
EXTERNRT char* rtxBigIntToDynStr | ( | OSCTXT * | pctxt, |
const OSBigInt * | pInt, | ||
int | radix | ||
) |
This function is used to convert a binary big integer value to a dynamic string.
Memory for the string is allocated using the rtxMemAlloc function. It may be freed using rtxMemFreePtr or when the context if freed.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to convert. |
radix | Radix of the string value, Valid values are 2, 8, 10, or 16. |
EXTERNRT OSBOOL rtxBigIntToReal | ( | const OSBigInt * | pSrc, |
OSREAL * | pvalue | ||
) |
This function converts the given big integer to a real, if it will fit without requiring rounding (i.e.
loss of precision).
pvalue | Receives the OSREAL value. If null, this function only tests whether the conversion can be done. |
EXTERNRT int rtxBigIntToString | ( | OSCTXT * | pctxt, |
const OSBigInt * | pInt, | ||
int | radix, | ||
char * | str, | ||
OSSIZE | strSize | ||
) |
This function is used to convert a binary big integer value to a string.
pctxt | Pointer to a context structure. |
pInt | Pointer to big integer structure to convert. |
radix | Radix of the string value, Valid values are 2, 8, 10, or 16. |
str | Character string buffer to receive converted value. |
strSize | Size, in bytes, of the character string buffer. |
EXTERN OSSIZE rtxRadixDigitsToBase2 | ( | OSUINT8 | radix, |
OSSIZE | n | ||
) |
Return the number of base 2 digits that may be required to represent an integer having n radix digits (assuming the base 2 number is unsigned).
This may return a larger value than the actual value.
radix | 8, 10, or 16 |