From a4d7e186fbb8dd347a034e58ca4f1c419c1188cc Mon Sep 17 00:00:00 2001
From: sewardj <unknown>
Date: Tue, 6 Jul 1999 15:20:59 +0000
Subject: [PATCH] [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.

---
 ghc/includes/sainteger.h | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 ghc/includes/sainteger.h

diff --git a/ghc/includes/sainteger.h b/ghc/includes/sainteger.h
new file mode 100644
index 000000000000..3086a5a988cc
--- /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 );
+
-- 
GitLab