00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #ifndef _RTXBIGINT_H_
00029 #define _RTXBIGINT_H_
00030
00031 #include "rtxsrc/rtxContext.h"
00032
00033
00034
00035 typedef struct OSBigInt {
00036 int numocts;
00037 OSOCTET *mag;
00038 int sign;
00039
00040 int allocated;
00041 OSBOOL dynamic;
00042 } OSBigInt;
00043
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049
00050
00051 EXTERNRT void rtxBigIntInit (OSBigInt* pInt);
00052 EXTERNRT int rtxBigIntSetStr (OSCTXT* pCtxt, OSBigInt* pInt,
00053 const char* value, int radix);
00054 EXTERNRT int rtxBigIntSetInt64 (OSCTXT* pCtxt, OSBigInt* pInt,
00055 OSINT64 value);
00056 EXTERNRT int rtxBigIntSetUInt64 (OSCTXT* pCtxt, OSBigInt* pInt,
00057 OSUINT64 value);
00058 EXTERNRT int rtxBigIntSetBytes (OSCTXT* pCtxt, OSBigInt* pInt,
00059 OSOCTET* value, int vallen);
00060 EXTERNRT int rtxBigIntGetDataLen (const OSBigInt* pInt);
00061 EXTERNRT int rtxBigIntGetData (OSCTXT* pCtxt, const OSBigInt* pInt,
00062 OSOCTET* buffer, int bufSize);
00063 EXTERNRT int rtxBigIntDigitsNum (const OSBigInt* pInt, int radix);
00064 EXTERNRT int rtxBigIntCopy (OSCTXT* pCtxt, const OSBigInt* pSrc, OSBigInt* pDst);
00065 EXTERNRT int rtxBigIntFastCopy (OSCTXT* pCtxt, const OSBigInt* pSrc, OSBigInt* pDst);
00066 EXTERNRT int rtxBigIntToString (OSCTXT* pCtxt, const OSBigInt* pInt, int radix,
00067 char* str, int strSize);
00068 EXTERNRT int rtxBigIntPrint (const OSUTF8CHAR* name, const OSBigInt* bigint, int radix);
00069 EXTERNRT int rtxBigIntCompare (const OSBigInt* arg1, const OSBigInt* arg2);
00070 EXTERNRT int rtxBigIntStrCompare (OSCTXT* pCtxt, const char* arg1,
00071 const char* arg2);
00072 EXTERNRT void rtxBigIntFree (OSCTXT* pCtxt, OSBigInt* pInt);
00073
00074
00075 EXTERNRT int rtxBigIntAdd
00076 (OSCTXT* pctxt,
00077 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00078
00079 EXTERNRT int rtxBigIntSubtract
00080 (OSCTXT* pctxt,
00081 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00082
00083 EXTERNRT int rtxBigIntMultiply
00084 (OSCTXT* pctxt,
00085 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00086
00087
00088 EXTERNRT unsigned short rtxBigIntBitsPerDigit (int radix);
00089 EXTERNRT short rtxBigIntDigitsPerByte (int halfRadix);
00090 EXTERNRT short rtxBigIntByteRadix (int halfRadix);
00091
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095
00096 #endif
00097