Several changes: did not work right when compiled with the ANSI C compiler
authorceriel <none@none>
Wed, 24 Nov 1993 15:37:27 +0000 (15:37 +0000)
committerceriel <none@none>
Wed, 24 Nov 1993 15:37:27 +0000 (15:37 +0000)
19 files changed:
mach/proto/fp/FP_types.h
mach/proto/fp/adf4.c
mach/proto/fp/adf8.c
mach/proto/fp/cff4.c
mach/proto/fp/cff8.c
mach/proto/fp/cif4.c
mach/proto/fp/cif8.c
mach/proto/fp/cuf4.c
mach/proto/fp/cuf8.c
mach/proto/fp/dvf4.c
mach/proto/fp/dvf8.c
mach/proto/fp/fif4.c
mach/proto/fp/fif8.c
mach/proto/fp/mlf4.c
mach/proto/fp/mlf8.c
mach/proto/fp/ngf4.c
mach/proto/fp/ngf8.c
mach/proto/fp/sbf4.c
mach/proto/fp/sbf8.c

index f004106..a23f32b 100644 (file)
@@ -79,24 +79,24 @@ _PROTOTYPE( void zrf_ext, (EXTEND *e1));
 _PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size));
 _PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size));
 _PROTOTYPE( void _fptrp, (int));
-_PROTOTYPE( SINGLE adf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE adf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE sbf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE sbf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE dvf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE dvf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE mlf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE mlf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE ngf4, (SINGLE f));
-_PROTOTYPE( DOUBLE ngf8, (DOUBLE f));
+_PROTOTYPE( void adf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void adf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void sbf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void sbf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void dvf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void dvf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void mlf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void mlf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void ngf4, (SINGLE f));
+_PROTOTYPE( void ngf8, (DOUBLE f));
 _PROTOTYPE( void zrf4, (SINGLE *l));
 _PROTOTYPE( void zrf8, (DOUBLE *z));
-_PROTOTYPE( SINGLE cff4, (DOUBLE src));
-_PROTOTYPE( DOUBLE cff8, (SINGLE src));
-_PROTOTYPE( SINGLE cif4, (int ss, long src));
-_PROTOTYPE( DOUBLE cif8, (int ss, long src));
-_PROTOTYPE( SINGLE cuf4, (int ss, long src));
-_PROTOTYPE( DOUBLE cuf8, (int ss, long src));
+_PROTOTYPE( void cff4, (DOUBLE src));
+_PROTOTYPE( void cff8, (SINGLE src));
+_PROTOTYPE( void cif4, (int ss, long src));
+_PROTOTYPE( void cif8, (int ss, long src));
+_PROTOTYPE( void cuf4, (int ss, long src));
+_PROTOTYPE( void cuf8, (int ss, long src));
 _PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src));
 _PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src));
 _PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1));
index a6cb9eb..572f3da 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-SINGLE
+void
 adf4(s2,s1)
 SINGLE s1,s2;
 {
@@ -20,14 +20,13 @@ SINGLE      s1,s2;
 
        if (s1 == (SINGLE) 0) {
                s1 = s2;
-               return s1;
+               return;
        }
        if (s2 == (SINGLE) 0) {
-               return s1;
+               return;
        }
        extend(&s1,&e1,sizeof(SINGLE));
        extend(&s2,&e2,sizeof(SINGLE));
        add_ext(&e1,&e2);
        compact(&e1,&s1,sizeof(SINGLE));
-       return s1;
 }
index c9d16e9..387c975 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-DOUBLE
+void
 adf8(s2,s1)
 DOUBLE s1,s2;
 {
@@ -19,15 +19,14 @@ DOUBLE      s1,s2;
 
        if (s1.d[0] == 0 && s1.d[1] == 0) {
                s1 = s2;
-               return s1;
+               return;
        }
        if (s2.d[0] == 0 && s2.d[1] == 0) {
-               return s1;
+               return;
        }
 
        extend(&s1.d[0],&e1,sizeof(DOUBLE));
        extend(&s2.d[0],&e2,sizeof(DOUBLE));
        add_ext(&e1,&e2);
        compact(&e1,&s1.d[0],sizeof(DOUBLE));
-       return s1;
 }
index 7154661..ae3b740 100644 (file)
@@ -17,7 +17,7 @@
 
 #include       "FP_types.h"
 
-SINGLE
+void
 cff4(src)
 DOUBLE src;    /* the source itself -  THIS TIME it's DOUBLE */
 {
@@ -25,5 +25,4 @@ DOUBLE        src;    /* the source itself -  THIS TIME it's DOUBLE */
 
        extend(&src.d[0],&buf,sizeof(DOUBLE));  /* no matter what */
        compact(&buf,&(src.d[1]),sizeof(SINGLE));
-       return *(SINGLE *)&(src.d[1]);
 }
index 9aa85e1..a851803 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "FP_types.h"
 
-DOUBLE
+void
 cff8(src)
 SINGLE src;
 {
@@ -25,5 +25,4 @@ SINGLE        src;
 
        extend(&src,&buf,sizeof(SINGLE));       /* no matter what */
        compact(&buf, &src,sizeof(DOUBLE));
-       return *(DOUBLE *) ((void *) &src);
 }
index cca3540..160d5f6 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "FP_types.h"
 
-SINGLE
+void
 cif4(ss,src)
 int    ss;     /* source size */
 long   src;    /* largest possible integer to convert */
@@ -40,7 +40,7 @@ long  src;    /* largest possible integer to convert */
        }
        if (i_src == 0) {
                *result = (SINGLE) 0L;
-               return(0L);
+               return;
        }
                        /* ESTABLISHED THAT src != 0    */
                        /* adjust exponent field        */
@@ -53,5 +53,4 @@ long  src;    /* largest possible integer to convert */
                buf.m1 <<= 16;
        nrm_ext(&buf);          /* adjust mantissa field        */
        compact(&buf, result,sizeof(SINGLE));   /* put on stack */
-       return(*result);
 }
index 0413a57..1ab9798 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "FP_types.h"
 
-DOUBLE
+void
 cif8(ss,src)
 int    ss;     /* source size */
 long   src;    /* largest possible integer to convert */
@@ -39,7 +39,7 @@ long  src;    /* largest possible integer to convert */
        }
        if (i_src == 0) {
                zrf8(result);
-               return(*result);
+               return;
        }
                        /* ESTABLISHED THAT src != 0    */
                        /* adjust exponent field        */
@@ -52,5 +52,4 @@ long  src;    /* largest possible integer to convert */
                buf.m1 <<= 16;
        nrm_ext(&buf);
        compact(&buf,&result->d[0],8);
-       return(*result);
 }
index c360f23..c022f0e 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "FP_types.h"
 
-SINGLE
+void
 cuf4(ss,src)
 int    ss;     /* source size */
 long   src;    /* largest possible integer to convert */
@@ -40,7 +40,7 @@ long  src;    /* largest possible integer to convert */
        }
        if (i_src == 0) {
                *result = (SINGLE) 0L;
-               return (SINGLE) 0L;
+               return;
        }
                        /* ESTABLISHED THAT src != 0    */
 
@@ -54,5 +54,4 @@ long  src;    /* largest possible integer to convert */
                        /* adjust mantissa field        */
        nrm_ext(&buf);
        compact(&buf,result,4);
-       return *result;
 }
index 630726e..d18ec6c 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "FP_types.h"
 
-DOUBLE
+void
 cuf8(ss,src)
 int    ss;     /* source size */
 long   src;    /* largest possible integer to convert */
@@ -51,5 +51,4 @@ long  src;    /* largest possible integer to convert */
                        /* adjust mantissa field        */
        nrm_ext(&buf);
        compact(&buf,(unsigned long *) (void *)&ss,8);
-       return *((DOUBLE *) (void *)&ss);
 }
index 5f4ff70..7d82cd8 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-SINGLE
+void
 dvf4(s2,s1)
 SINGLE s1,s2;
 {
@@ -23,5 +23,4 @@ SINGLE        s1,s2;
                /* do a divide */
        div_ext(&e1,&e2);
        compact(&e1,&s1,sizeof(SINGLE));
-       return s1;
 }
index 79c1a6c..fafe50f 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-DOUBLE
+void
 dvf8(s2,s1)
 DOUBLE s1,s2;
 {
@@ -23,5 +23,4 @@ DOUBLE        s1,s2;
                /* do a divide */
        div_ext(&e1,&e2);
        compact(&e1,&s1.d[0],sizeof(DOUBLE));
-       return s1;
 }
index 3ab308b..0593724 100644 (file)
@@ -39,5 +39,8 @@ struct fif4_returns *p;
        b64_sft(&e1.mantissa, 63 - e1.exp);
        b64_sft(&e1.mantissa, e1.exp - 63);     /* "loose" low order bits */
        compact(&e1,&(p->ipart),sizeof(SINGLE));
-       p->fpart = sbf4(p->ipart, y);
+       extend(&(p->ipart), &e2, sizeof(SINGLE));
+       extend(&y, &e1, sizeof(SINGLE));
+       sub_ext(&e1, &e2);
+       compact(&e1, &(p->fpart), sizeof(SINGLE));
 }
index 950a09c..9f1b9b1 100644 (file)
@@ -41,5 +41,8 @@ struct fif8_returns *p;
        b64_sft(&e1.mantissa, 63 - e1.exp);
        b64_sft(&e1.mantissa, e1.exp - 63);     /* "loose" low order bits */
        compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
-       p->fpart = sbf8(p->ipart, y);
+       extend(&(p->ipart.d[0]), &e2, sizeof(DOUBLE));
+       extend(&y.d[0], &e1, sizeof(DOUBLE));
+       sub_ext(&e1, &e2);
+       compact(&e1, &(p->fpart.d[0]), sizeof(DOUBLE));
 }
index 7b786f9..d5f515d 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-SINGLE
+void
 mlf4(s2,s1)
 SINGLE s1,s2;
 {
@@ -22,5 +22,4 @@ SINGLE        s1,s2;
                /* do a multiply */
        mul_ext(&e1,&e2);
        compact(&e1,&s1,sizeof(SINGLE));
-       return(s1);
 }
index ebba51e..b43cdf3 100644 (file)
@@ -11,7 +11,7 @@
 
 #include       "FP_types.h"
 
-DOUBLE
+void
 mlf8(s2,s1)
 DOUBLE s1,s2;
 {
@@ -22,5 +22,4 @@ DOUBLE        s1,s2;
                /* do a multiply */
        mul_ext(&e1,&e2);
        compact(&e1,&s1.d[0],sizeof(DOUBLE));
-       return(s1);
 }
index 87ebb47..9f1f812 100644 (file)
@@ -14,7 +14,7 @@
 #include "get_put.h"
 
 #define OFF ((FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
-SINGLE
+void
 ngf4(f)
 SINGLE f;
 {
@@ -24,5 +24,4 @@ SINGLE        f;
                p = (unsigned char *) &f + OFF;
                *p ^= 0x80;
        }
-       return f;
 }
index 16ad887..473ffa5 100644 (file)
@@ -15,7 +15,7 @@
 
 #define OFF ((FL_MSL_AT_LOW_ADDRESS ? 0 : 4) + (FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
 
-DOUBLE
+void
 ngf8(f)
 DOUBLE f;
 {
@@ -25,5 +25,4 @@ DOUBLE        f;
                p = (unsigned char *) &f + OFF;
                *p ^= 0x80;
        }
-       return f;
 }
index 2312c13..368c111 100644 (file)
 
 #include       "FP_types.h"
 
-SINGLE
+void
 sbf4(s2,s1)
 SINGLE s1,s2;
 {
-       SINGLE *result = &s1;   /* s1 may not be in a register! */
+       EXTEND e1,e2;
 
        if (s2 == (SINGLE) 0) {
-               return s1;
+               return;
        }
-       s2 = ngf4(s2);
-       *result = adf4(s2,s1);
-       return(s1);     /* add and return result */
+       extend(&s1,&e1,sizeof(SINGLE));
+       extend(&s2,&e2,sizeof(SINGLE));
+       sub_ext(&e1,&e2);
+       compact(&e1,&s1,sizeof(SINGLE));
 }
-
index f580797..9d4c106 100644 (file)
 
 #include       "FP_types.h"
 
-DOUBLE
+void
 sbf8(s2,s1)
 DOUBLE s1,s2;
 {
-       DOUBLE *result = &s1;   /* s1 may not be in a register! */
+       EXTEND e1, e2;
 
        if (s2.d[0] == 0 && s2.d[1] == 0) {
-               return s1;
+               return;
        }
-       s2 = ngf8(s2);
-       *result = adf8(s2,s1);  /* add and return result */
-       return(s1);
+       extend(&s1.d[0],&e1,sizeof(DOUBLE));
+       extend(&s2.d[0],&e2,sizeof(DOUBLE));
+       sub_ext(&e1,&e2);
+       compact(&e1,&s1.d[0],sizeof(DOUBLE));
 }