From: sewardj Date: Tue, 6 Jul 1999 15:20:59 +0000 (+0000) Subject: [project @ 1999-07-06 15:20:59 by sewardj] X-Git-Tag: Approximately_9120_patches~6025 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a4d7e186fbb8dd347a034e58ca4f1c419c1188cc;p=ghc-hetmet.git [project @ 1999-07-06 15:20:59 by sewardj] Header file for an alternative bignum implementation, which is in interpreter/sainteger.c. Currently used by STGHugs. Temporary -- until we resolve GMP licensing issues. --- diff --git a/ghc/includes/sainteger.h b/ghc/includes/sainteger.h new file mode 100644 index 0000000..3086a5a --- /dev/null +++ b/ghc/includes/sainteger.h @@ -0,0 +1,47 @@ + +#define B_BASE 256 +#define B_BASE_FLT (256.0) + +/* this really ought to be abstract */ +typedef + struct { + int sign; + int size; + int used; + unsigned char stuff[0]; + } + B; + +/* the ops themselves */ +int do_getsign ( B* x ); +int do_cmp ( B* x, B* y ); +void do_add ( B* x, B* y, int sizeRes, B* res ); +void do_sub ( B* x, B* y, int sizeRes, B* res ); +void do_mul ( B* x, B* y, int sizeRes, B* res ); +void do_qrm ( B* x, B* y, int sizeRes, B* qres, B* rres ); +void do_neg ( B* x, int sizeRes, B* res ); + +void do_renormalise ( B* x ); +int is_sane ( B* x ); + +void do_fromInt ( int n, int sizeRes, B* res ); +void do_fromWord ( unsigned int n, int sizeRes, B* res ); +void do_fromStr ( char* str, int sizeRes, B* res ); + +int do_toInt ( B* x ); +unsigned int do_toWord ( B* x ); +float do_toFloat ( B* x ); +double do_toDouble ( B* x ); + +/* the number of bytes needed to hold result of an op */ +int size_add ( B* x, B* y ); +int size_sub ( B* x, B* y ); +int size_mul ( B* x, B* y ); +int size_qrm ( B* x, B* y ); +int size_neg ( B* x ); +int size_fromInt ( void ); +int size_fromWord ( void ); +int size_fromStr ( char* str ); +int size_dblmantissa ( void ); +int size_fltmantissa ( void ); +