CUBRID Engine  latest
mprec.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "mprec.h"
Include dependency graph for mprec.c:

Go to the source code of this file.

Macros

#define _reent   _Jv_reent
 
#define _Bigint   _Jv_Bigint
 
#define _REENT_CHECK_MP(x)
 
#define _REENT_MP_FREELIST(x)   ((x)->_freelist)
 
#define _REENT_MP_P5S(x)   ((x)->_p5s)
 
#define d0   word0(d)
 
#define d1   word1(d)
 

Typedefs

typedef unsigned long __ULong
 
typedef long __Long
 

Functions

static void * mprec_calloc (void *ignore, size_t x1, size_t x2)
 
_Bigint_DEFUN (Balloc,(ptr, k), struct _reent *ptr _AND int k)
 
void _DEFUN (Bfree,(ptr, v), struct _reent *ptr _AND _Bigint *v)
 
_Bigint_DEFUN (multadd,(ptr, b, m, a), struct _reent *ptr _AND _Bigint *b _AND int m _AND int a)
 
int _DEFUN (hi0bits,(x), __ULong x)
 
int _DEFUN (lo0bits,(y), __ULong *y)
 
_Bigint_DEFUN (i2b,(ptr, i), struct _reent *ptr _AND int i)
 
_Bigint_DEFUN (mult,(ptr, a, b), struct _reent *ptr _AND _Bigint *a _AND _Bigint *b)
 
_Bigint_DEFUN (pow5mult,(ptr, b, k), struct _reent *ptr _AND _Bigint *b _AND int k)
 
_Bigint_DEFUN (lshift,(ptr, b, k), struct _reent *ptr _AND _Bigint *b _AND int k)
 
int _DEFUN (cmp,(a, b), _Bigint *a _AND _Bigint *b)
 
_Bigint_DEFUN (diff,(ptr, a, b), struct _reent *ptr _AND _Bigint *a _AND _Bigint *b)
 
_Bigint_DEFUN (d2b,(ptr, _d, e, bits), struct _reent *ptr _AND double _d _AND int *e _AND int *bits)
 

Variables

_CONST double tens []
 
_CONST double bigtens [] = { 1e16, 1e32, 1e64, 1e128, 1e256 }
 
_CONST double tinytens [] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }
 

Macro Definition Documentation

#define _Bigint   _Jv_Bigint

Definition at line 94 of file mprec.c.

Referenced by _DEFUN(), and mprec_calloc().

#define _reent   _Jv_reent

Definition at line 93 of file mprec.c.

Referenced by _DEFUN().

#define _REENT_CHECK_MP (   x)

Definition at line 96 of file mprec.c.

Referenced by _DEFUN().

#define _REENT_MP_FREELIST (   x)    ((x)->_freelist)

Definition at line 97 of file mprec.c.

Referenced by _DEFUN().

#define _REENT_MP_P5S (   x)    ((x)->_p5s)

Definition at line 98 of file mprec.c.

Referenced by _DEFUN().

Typedef Documentation

typedef long __Long

Definition at line 101 of file mprec.c.

typedef unsigned long __ULong

Definition at line 100 of file mprec.c.

Function Documentation

_Bigint* _DEFUN ( Balloc  ,
(ptr, k)  ,
struct _reent *ptr _AND int  k 
)

Definition at line 112 of file mprec.c.

References _Bigint, _REENT_CHECK_MP, _REENT_MP_FREELIST, assert, mprec_calloc(), NULL, and rv.

Referenced by _DEFUN().

Here is the caller graph for this function:

void _DEFUN ( Bfree  ,
(ptr, v)  ,
struct _reent *ptr _AND _Bigint v 
)

Definition at line 160 of file mprec.c.

References _Bigint, _REENT_CHECK_MP, and _REENT_MP_FREELIST.

_Bigint* _DEFUN ( multadd  ,
(ptr, b, m, a)  ,
struct _reent *ptr _AND _Bigint *b _AND int m _AND int  a 
)

Definition at line 171 of file mprec.c.

References _AND, _Bigint, _CONST, _DEFUN(), _reent, Balloc, Bcopy, Bfree, i, multadd, and s2b.

int _DEFUN ( hi0bits  ,
(x)  ,
__ULong  x 
)

Definition at line 251 of file mprec.c.

int _DEFUN ( lo0bits  ,
(y)  ,
__ULong y 
)

Definition at line 285 of file mprec.c.

References _Bigint.

_Bigint* _DEFUN ( i2b  ,
(ptr, i ,
struct _reent *ptr _AND int  i 
)

Definition at line 335 of file mprec.c.

References _Bigint, Balloc, and i.

_Bigint* _DEFUN ( mult  ,
(ptr, a, b)  ,
struct _reent *ptr _AND _Bigint *a _AND _Bigint b 
)

Definition at line 346 of file mprec.c.

References _Bigint, Balloc, and Storeinc.

_Bigint* _DEFUN ( pow5mult  ,
(ptr, b, k)  ,
struct _reent *ptr _AND _Bigint *b _AND int  k 
)

Definition at line 438 of file mprec.c.

References _Bigint, _CONST, _REENT_CHECK_MP, _REENT_MP_P5S, Bfree, i, i2b, mult, and multadd.

_Bigint* _DEFUN ( lshift  ,
(ptr, b, k)  ,
struct _reent *ptr _AND _Bigint *b _AND int  k 
)

Definition at line 477 of file mprec.c.

References _Bigint, Balloc, Bfree, and i.

int _DEFUN ( cmp  ,
(a, b)  ,
_Bigint *a _AND _Bigint b 
)

Definition at line 537 of file mprec.c.

References _Bigint, and i.

_Bigint* _DEFUN ( diff  ,
(ptr, a, b)  ,
struct _reent *ptr _AND _Bigint *a _AND _Bigint b 
)
_Bigint* _DEFUN ( d2b  ,
(ptr, _d, e, bits)  ,
struct _reent *ptr _AND double _d _AND int *e _AND int *  bits 
)
static void* mprec_calloc ( void *  ignore,
size_t  x1,
size_t  x2 
)
static

Definition at line 104 of file mprec.c.

References _Bigint.

Referenced by _DEFUN().

Here is the caller graph for this function:

Variable Documentation

_CONST double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }

Definition at line 971 of file mprec.c.

_CONST double tens[]
Initial value:
= {
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22, 1e23, 1e24
}

Definition at line 964 of file mprec.c.

_CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }

Definition at line 973 of file mprec.c.