From: ceriel Date: Wed, 24 Nov 1993 15:37:27 +0000 (+0000) Subject: Several changes: did not work right when compiled with the ANSI C compiler X-Git-Tag: release-5-5~185 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=fe99903321b796b9f9666606172dd096c7b163e5;p=ack.git Several changes: did not work right when compiled with the ANSI C compiler --- diff --git a/mach/proto/fp/FP_types.h b/mach/proto/fp/FP_types.h index f004106d1..a23f32b89 100644 --- a/mach/proto/fp/FP_types.h +++ b/mach/proto/fp/FP_types.h @@ -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)); diff --git a/mach/proto/fp/adf4.c b/mach/proto/fp/adf4.c index a6cb9eb6d..572f3daa3 100644 --- a/mach/proto/fp/adf4.c +++ b/mach/proto/fp/adf4.c @@ -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; } diff --git a/mach/proto/fp/adf8.c b/mach/proto/fp/adf8.c index c9d16e9cd..387c975c0 100644 --- a/mach/proto/fp/adf8.c +++ b/mach/proto/fp/adf8.c @@ -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; } diff --git a/mach/proto/fp/cff4.c b/mach/proto/fp/cff4.c index 715466157..ae3b740c5 100644 --- a/mach/proto/fp/cff4.c +++ b/mach/proto/fp/cff4.c @@ -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]); } diff --git a/mach/proto/fp/cff8.c b/mach/proto/fp/cff8.c index 9aa85e19e..a851803ad 100644 --- a/mach/proto/fp/cff8.c +++ b/mach/proto/fp/cff8.c @@ -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); } diff --git a/mach/proto/fp/cif4.c b/mach/proto/fp/cif4.c index cca3540a4..160d5f6d2 100644 --- a/mach/proto/fp/cif4.c +++ b/mach/proto/fp/cif4.c @@ -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); } diff --git a/mach/proto/fp/cif8.c b/mach/proto/fp/cif8.c index 0413a5793..1ab979813 100644 --- a/mach/proto/fp/cif8.c +++ b/mach/proto/fp/cif8.c @@ -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); } diff --git a/mach/proto/fp/cuf4.c b/mach/proto/fp/cuf4.c index c360f23dc..c022f0e90 100644 --- a/mach/proto/fp/cuf4.c +++ b/mach/proto/fp/cuf4.c @@ -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; } diff --git a/mach/proto/fp/cuf8.c b/mach/proto/fp/cuf8.c index 630726efd..d18ec6c7a 100644 --- a/mach/proto/fp/cuf8.c +++ b/mach/proto/fp/cuf8.c @@ -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); } diff --git a/mach/proto/fp/dvf4.c b/mach/proto/fp/dvf4.c index 5f4ff7027..7d82cd8b8 100644 --- a/mach/proto/fp/dvf4.c +++ b/mach/proto/fp/dvf4.c @@ -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; } diff --git a/mach/proto/fp/dvf8.c b/mach/proto/fp/dvf8.c index 79c1a6c96..fafe50f53 100644 --- a/mach/proto/fp/dvf8.c +++ b/mach/proto/fp/dvf8.c @@ -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; } diff --git a/mach/proto/fp/fif4.c b/mach/proto/fp/fif4.c index 3ab308b8e..059372469 100644 --- a/mach/proto/fp/fif4.c +++ b/mach/proto/fp/fif4.c @@ -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)); } diff --git a/mach/proto/fp/fif8.c b/mach/proto/fp/fif8.c index 950a09c28..9f1b9b15e 100644 --- a/mach/proto/fp/fif8.c +++ b/mach/proto/fp/fif8.c @@ -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)); } diff --git a/mach/proto/fp/mlf4.c b/mach/proto/fp/mlf4.c index 7b786f9d2..d5f515d19 100644 --- a/mach/proto/fp/mlf4.c +++ b/mach/proto/fp/mlf4.c @@ -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); } diff --git a/mach/proto/fp/mlf8.c b/mach/proto/fp/mlf8.c index ebba51eec..b43cdf3c1 100644 --- a/mach/proto/fp/mlf8.c +++ b/mach/proto/fp/mlf8.c @@ -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); } diff --git a/mach/proto/fp/ngf4.c b/mach/proto/fp/ngf4.c index 87ebb476a..9f1f812ea 100644 --- a/mach/proto/fp/ngf4.c +++ b/mach/proto/fp/ngf4.c @@ -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; } diff --git a/mach/proto/fp/ngf8.c b/mach/proto/fp/ngf8.c index 16ad887f7..473ffa510 100644 --- a/mach/proto/fp/ngf8.c +++ b/mach/proto/fp/ngf8.c @@ -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; } diff --git a/mach/proto/fp/sbf4.c b/mach/proto/fp/sbf4.c index 2312c135d..368c11102 100644 --- a/mach/proto/fp/sbf4.c +++ b/mach/proto/fp/sbf4.c @@ -11,17 +11,17 @@ #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)); } - diff --git a/mach/proto/fp/sbf8.c b/mach/proto/fp/sbf8.c index f5807976f..9d4c1067c 100644 --- a/mach/proto/fp/sbf8.c +++ b/mach/proto/fp/sbf8.c @@ -11,16 +11,17 @@ #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)); }