[project @ 1999-07-06 15:20:59 by sewardj]
[ghc-hetmet.git] / ghc / includes / sainteger.h
1
2 #define B_BASE 256
3 #define B_BASE_FLT (256.0)
4
5 /* this really ought to be abstract */
6 typedef 
7    struct {
8       int            sign;
9       int            size;
10       int            used;
11       unsigned char  stuff[0];
12    }
13    B;
14
15 /* the ops themselves */
16 int  do_getsign  ( B* x );
17 int  do_cmp      ( B* x, B* y );
18 void do_add      ( B* x, B* y, int sizeRes, B* res );
19 void do_sub      ( B* x, B* y, int sizeRes, B* res );
20 void do_mul      ( B* x, B* y, int sizeRes, B* res );
21 void do_qrm      ( B* x, B* y, int sizeRes, B* qres, B* rres );
22 void do_neg      ( B* x,       int sizeRes, B* res );
23
24 void do_renormalise ( B* x );
25 int  is_sane ( B* x );
26
27 void do_fromInt  ( int            n,   int sizeRes, B*   res );
28 void do_fromWord ( unsigned int   n,   int sizeRes, B*   res );
29 void do_fromStr  ( char*        str,   int sizeRes, B*   res );
30
31 int          do_toInt    ( B* x );
32 unsigned int do_toWord   ( B* x );
33 float        do_toFloat  ( B* x );
34 double       do_toDouble ( B* x );
35
36 /* the number of bytes needed to hold result of an op */
37 int  size_add      ( B* x, B* y );
38 int  size_sub      ( B* x, B* y );
39 int  size_mul      ( B* x, B* y );
40 int  size_qrm      ( B* x, B* y );
41 int  size_neg      ( B* x );
42 int  size_fromInt  ( void );
43 int  size_fromWord ( void );
44 int  size_fromStr  ( char* str );
45 int  size_dblmantissa ( void );
46 int  size_fltmantissa ( void );
47