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
00053 EXTERNRT int rtxBigIntSetStr (OSCTXT* pCtxt, OSBigInt* pInt,
00054 const char* value, int radix);
00055 EXTERNRT int rtxBigIntSetStrn (OSCTXT* pCtxt, OSBigInt* pInt,
00056 const char* value, size_t len, int radix);
00057 EXTERNRT int rtxBigIntSetInt64 (OSCTXT* pCtxt, OSBigInt* pInt,
00058 OSINT64 value);
00059 EXTERNRT int rtxBigIntSetUInt64 (OSCTXT* pCtxt, OSBigInt* pInt,
00060 OSUINT64 value);
00061 EXTERNRT int rtxBigIntSetBytes (OSCTXT* pCtxt, OSBigInt* pInt,
00062 OSOCTET* value, int vallen);
00063 EXTERNRT int rtxBigIntGetDataLen (const OSBigInt* pInt);
00064 EXTERNRT int rtxBigIntGetData (OSCTXT* pCtxt, const OSBigInt* pInt,
00065 OSOCTET* buffer, int bufSize);
00066 EXTERNRT int rtxBigIntDigitsNum (const OSBigInt* pInt, int radix);
00067 EXTERNRT int rtxBigIntCopy (OSCTXT* pCtxt, const OSBigInt* pSrc, OSBigInt* pDst);
00068 EXTERNRT int rtxBigIntFastCopy (OSCTXT* pCtxt, const OSBigInt* pSrc, OSBigInt* pDst);
00069 EXTERNRT int rtxBigIntToString (OSCTXT* pCtxt, const OSBigInt* pInt, int radix,
00070 char* str, int strSize);
00071 EXTERNRT int rtxBigIntPrint (const OSUTF8CHAR* name, const OSBigInt* bigint, int radix);
00072 EXTERNRT int rtxBigIntCompare (const OSBigInt* arg1, const OSBigInt* arg2);
00073 EXTERNRT int rtxBigIntStrCompare (OSCTXT* pCtxt, const char* arg1,
00074 const char* arg2);
00075 EXTERNRT void rtxBigIntFree (OSCTXT* pCtxt, OSBigInt* pInt);
00076
00077
00078 EXTERNRT int rtxBigIntAdd
00079 (OSCTXT* pctxt,
00080 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00081
00082 EXTERNRT int rtxBigIntSubtract
00083 (OSCTXT* pctxt,
00084 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00085
00086 EXTERNRT int rtxBigIntMultiply
00087 (OSCTXT* pctxt,
00088 OSBigInt* result, const OSBigInt* arg1, const OSBigInt* arg2);
00089
00090
00091 EXTERNRT unsigned short rtxBigIntBitsPerDigit (int radix);
00092 EXTERNRT short rtxBigIntDigitsPerByte (int halfRadix);
00093 EXTERNRT short rtxBigIntByteRadix (int halfRadix);
00094
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098
00099 #endif
00100