Several changes: did not work right when compiled with the ANSI C compiler
This commit is contained in:
parent
b7a5c1acc0
commit
fe99903321
19 changed files with 59 additions and 66 deletions
|
@ -79,24 +79,24 @@ _PROTOTYPE( void zrf_ext, (EXTEND *e1));
|
||||||
_PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size));
|
_PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size));
|
||||||
_PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size));
|
_PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size));
|
||||||
_PROTOTYPE( void _fptrp, (int));
|
_PROTOTYPE( void _fptrp, (int));
|
||||||
_PROTOTYPE( SINGLE adf4, (SINGLE s2, SINGLE s1));
|
_PROTOTYPE( void adf4, (SINGLE s2, SINGLE s1));
|
||||||
_PROTOTYPE( DOUBLE adf8, (DOUBLE s2, DOUBLE s1));
|
_PROTOTYPE( void adf8, (DOUBLE s2, DOUBLE s1));
|
||||||
_PROTOTYPE( SINGLE sbf4, (SINGLE s2, SINGLE s1));
|
_PROTOTYPE( void sbf4, (SINGLE s2, SINGLE s1));
|
||||||
_PROTOTYPE( DOUBLE sbf8, (DOUBLE s2, DOUBLE s1));
|
_PROTOTYPE( void sbf8, (DOUBLE s2, DOUBLE s1));
|
||||||
_PROTOTYPE( SINGLE dvf4, (SINGLE s2, SINGLE s1));
|
_PROTOTYPE( void dvf4, (SINGLE s2, SINGLE s1));
|
||||||
_PROTOTYPE( DOUBLE dvf8, (DOUBLE s2, DOUBLE s1));
|
_PROTOTYPE( void dvf8, (DOUBLE s2, DOUBLE s1));
|
||||||
_PROTOTYPE( SINGLE mlf4, (SINGLE s2, SINGLE s1));
|
_PROTOTYPE( void mlf4, (SINGLE s2, SINGLE s1));
|
||||||
_PROTOTYPE( DOUBLE mlf8, (DOUBLE s2, DOUBLE s1));
|
_PROTOTYPE( void mlf8, (DOUBLE s2, DOUBLE s1));
|
||||||
_PROTOTYPE( SINGLE ngf4, (SINGLE f));
|
_PROTOTYPE( void ngf4, (SINGLE f));
|
||||||
_PROTOTYPE( DOUBLE ngf8, (DOUBLE f));
|
_PROTOTYPE( void ngf8, (DOUBLE f));
|
||||||
_PROTOTYPE( void zrf4, (SINGLE *l));
|
_PROTOTYPE( void zrf4, (SINGLE *l));
|
||||||
_PROTOTYPE( void zrf8, (DOUBLE *z));
|
_PROTOTYPE( void zrf8, (DOUBLE *z));
|
||||||
_PROTOTYPE( SINGLE cff4, (DOUBLE src));
|
_PROTOTYPE( void cff4, (DOUBLE src));
|
||||||
_PROTOTYPE( DOUBLE cff8, (SINGLE src));
|
_PROTOTYPE( void cff8, (SINGLE src));
|
||||||
_PROTOTYPE( SINGLE cif4, (int ss, long src));
|
_PROTOTYPE( void cif4, (int ss, long src));
|
||||||
_PROTOTYPE( DOUBLE cif8, (int ss, long src));
|
_PROTOTYPE( void cif8, (int ss, long src));
|
||||||
_PROTOTYPE( SINGLE cuf4, (int ss, long src));
|
_PROTOTYPE( void cuf4, (int ss, long src));
|
||||||
_PROTOTYPE( DOUBLE cuf8, (int ss, long src));
|
_PROTOTYPE( void cuf8, (int ss, long src));
|
||||||
_PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src));
|
_PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src));
|
||||||
_PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src));
|
_PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src));
|
||||||
_PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1));
|
_PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1));
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
adf4(s2,s1)
|
adf4(s2,s1)
|
||||||
SINGLE s1,s2;
|
SINGLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -20,14 +20,13 @@ SINGLE s1,s2;
|
||||||
|
|
||||||
if (s1 == (SINGLE) 0) {
|
if (s1 == (SINGLE) 0) {
|
||||||
s1 = s2;
|
s1 = s2;
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
if (s2 == (SINGLE) 0) {
|
if (s2 == (SINGLE) 0) {
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
extend(&s1,&e1,sizeof(SINGLE));
|
extend(&s1,&e1,sizeof(SINGLE));
|
||||||
extend(&s2,&e2,sizeof(SINGLE));
|
extend(&s2,&e2,sizeof(SINGLE));
|
||||||
add_ext(&e1,&e2);
|
add_ext(&e1,&e2);
|
||||||
compact(&e1,&s1,sizeof(SINGLE));
|
compact(&e1,&s1,sizeof(SINGLE));
|
||||||
return s1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
adf8(s2,s1)
|
adf8(s2,s1)
|
||||||
DOUBLE s1,s2;
|
DOUBLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -19,15 +19,14 @@ DOUBLE s1,s2;
|
||||||
|
|
||||||
if (s1.d[0] == 0 && s1.d[1] == 0) {
|
if (s1.d[0] == 0 && s1.d[1] == 0) {
|
||||||
s1 = s2;
|
s1 = s2;
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
if (s2.d[0] == 0 && s2.d[1] == 0) {
|
if (s2.d[0] == 0 && s2.d[1] == 0) {
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extend(&s1.d[0],&e1,sizeof(DOUBLE));
|
extend(&s1.d[0],&e1,sizeof(DOUBLE));
|
||||||
extend(&s2.d[0],&e2,sizeof(DOUBLE));
|
extend(&s2.d[0],&e2,sizeof(DOUBLE));
|
||||||
add_ext(&e1,&e2);
|
add_ext(&e1,&e2);
|
||||||
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
||||||
return s1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
cff4(src)
|
cff4(src)
|
||||||
DOUBLE src; /* the source itself - THIS TIME it's DOUBLE */
|
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 */
|
extend(&src.d[0],&buf,sizeof(DOUBLE)); /* no matter what */
|
||||||
compact(&buf,&(src.d[1]),sizeof(SINGLE));
|
compact(&buf,&(src.d[1]),sizeof(SINGLE));
|
||||||
return *(SINGLE *)&(src.d[1]);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
cff8(src)
|
cff8(src)
|
||||||
SINGLE src;
|
SINGLE src;
|
||||||
{
|
{
|
||||||
|
@ -25,5 +25,4 @@ SINGLE src;
|
||||||
|
|
||||||
extend(&src,&buf,sizeof(SINGLE)); /* no matter what */
|
extend(&src,&buf,sizeof(SINGLE)); /* no matter what */
|
||||||
compact(&buf, &src,sizeof(DOUBLE));
|
compact(&buf, &src,sizeof(DOUBLE));
|
||||||
return *(DOUBLE *) ((void *) &src);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
cif4(ss,src)
|
cif4(ss,src)
|
||||||
int ss; /* source size */
|
int ss; /* source size */
|
||||||
long src; /* largest possible integer to convert */
|
long src; /* largest possible integer to convert */
|
||||||
|
@ -40,7 +40,7 @@ long src; /* largest possible integer to convert */
|
||||||
}
|
}
|
||||||
if (i_src == 0) {
|
if (i_src == 0) {
|
||||||
*result = (SINGLE) 0L;
|
*result = (SINGLE) 0L;
|
||||||
return(0L);
|
return;
|
||||||
}
|
}
|
||||||
/* ESTABLISHED THAT src != 0 */
|
/* ESTABLISHED THAT src != 0 */
|
||||||
/* adjust exponent field */
|
/* adjust exponent field */
|
||||||
|
@ -53,5 +53,4 @@ long src; /* largest possible integer to convert */
|
||||||
buf.m1 <<= 16;
|
buf.m1 <<= 16;
|
||||||
nrm_ext(&buf); /* adjust mantissa field */
|
nrm_ext(&buf); /* adjust mantissa field */
|
||||||
compact(&buf, result,sizeof(SINGLE)); /* put on stack */
|
compact(&buf, result,sizeof(SINGLE)); /* put on stack */
|
||||||
return(*result);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
cif8(ss,src)
|
cif8(ss,src)
|
||||||
int ss; /* source size */
|
int ss; /* source size */
|
||||||
long src; /* largest possible integer to convert */
|
long src; /* largest possible integer to convert */
|
||||||
|
@ -39,7 +39,7 @@ long src; /* largest possible integer to convert */
|
||||||
}
|
}
|
||||||
if (i_src == 0) {
|
if (i_src == 0) {
|
||||||
zrf8(result);
|
zrf8(result);
|
||||||
return(*result);
|
return;
|
||||||
}
|
}
|
||||||
/* ESTABLISHED THAT src != 0 */
|
/* ESTABLISHED THAT src != 0 */
|
||||||
/* adjust exponent field */
|
/* adjust exponent field */
|
||||||
|
@ -52,5 +52,4 @@ long src; /* largest possible integer to convert */
|
||||||
buf.m1 <<= 16;
|
buf.m1 <<= 16;
|
||||||
nrm_ext(&buf);
|
nrm_ext(&buf);
|
||||||
compact(&buf,&result->d[0],8);
|
compact(&buf,&result->d[0],8);
|
||||||
return(*result);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
cuf4(ss,src)
|
cuf4(ss,src)
|
||||||
int ss; /* source size */
|
int ss; /* source size */
|
||||||
long src; /* largest possible integer to convert */
|
long src; /* largest possible integer to convert */
|
||||||
|
@ -40,7 +40,7 @@ long src; /* largest possible integer to convert */
|
||||||
}
|
}
|
||||||
if (i_src == 0) {
|
if (i_src == 0) {
|
||||||
*result = (SINGLE) 0L;
|
*result = (SINGLE) 0L;
|
||||||
return (SINGLE) 0L;
|
return;
|
||||||
}
|
}
|
||||||
/* ESTABLISHED THAT src != 0 */
|
/* ESTABLISHED THAT src != 0 */
|
||||||
|
|
||||||
|
@ -54,5 +54,4 @@ long src; /* largest possible integer to convert */
|
||||||
/* adjust mantissa field */
|
/* adjust mantissa field */
|
||||||
nrm_ext(&buf);
|
nrm_ext(&buf);
|
||||||
compact(&buf,result,4);
|
compact(&buf,result,4);
|
||||||
return *result;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
cuf8(ss,src)
|
cuf8(ss,src)
|
||||||
int ss; /* source size */
|
int ss; /* source size */
|
||||||
long src; /* largest possible integer to convert */
|
long src; /* largest possible integer to convert */
|
||||||
|
@ -51,5 +51,4 @@ long src; /* largest possible integer to convert */
|
||||||
/* adjust mantissa field */
|
/* adjust mantissa field */
|
||||||
nrm_ext(&buf);
|
nrm_ext(&buf);
|
||||||
compact(&buf,(unsigned long *) (void *)&ss,8);
|
compact(&buf,(unsigned long *) (void *)&ss,8);
|
||||||
return *((DOUBLE *) (void *)&ss);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
dvf4(s2,s1)
|
dvf4(s2,s1)
|
||||||
SINGLE s1,s2;
|
SINGLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -23,5 +23,4 @@ SINGLE s1,s2;
|
||||||
/* do a divide */
|
/* do a divide */
|
||||||
div_ext(&e1,&e2);
|
div_ext(&e1,&e2);
|
||||||
compact(&e1,&s1,sizeof(SINGLE));
|
compact(&e1,&s1,sizeof(SINGLE));
|
||||||
return s1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
dvf8(s2,s1)
|
dvf8(s2,s1)
|
||||||
DOUBLE s1,s2;
|
DOUBLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -23,5 +23,4 @@ DOUBLE s1,s2;
|
||||||
/* do a divide */
|
/* do a divide */
|
||||||
div_ext(&e1,&e2);
|
div_ext(&e1,&e2);
|
||||||
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
||||||
return s1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,8 @@ struct fif4_returns *p;
|
||||||
b64_sft(&e1.mantissa, 63 - e1.exp);
|
b64_sft(&e1.mantissa, 63 - e1.exp);
|
||||||
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
||||||
compact(&e1,&(p->ipart),sizeof(SINGLE));
|
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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,5 +41,8 @@ struct fif8_returns *p;
|
||||||
b64_sft(&e1.mantissa, 63 - e1.exp);
|
b64_sft(&e1.mantissa, 63 - e1.exp);
|
||||||
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
||||||
compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
|
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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
mlf4(s2,s1)
|
mlf4(s2,s1)
|
||||||
SINGLE s1,s2;
|
SINGLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -22,5 +22,4 @@ SINGLE s1,s2;
|
||||||
/* do a multiply */
|
/* do a multiply */
|
||||||
mul_ext(&e1,&e2);
|
mul_ext(&e1,&e2);
|
||||||
compact(&e1,&s1,sizeof(SINGLE));
|
compact(&e1,&s1,sizeof(SINGLE));
|
||||||
return(s1);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
mlf8(s2,s1)
|
mlf8(s2,s1)
|
||||||
DOUBLE s1,s2;
|
DOUBLE s1,s2;
|
||||||
{
|
{
|
||||||
|
@ -22,5 +22,4 @@ DOUBLE s1,s2;
|
||||||
/* do a multiply */
|
/* do a multiply */
|
||||||
mul_ext(&e1,&e2);
|
mul_ext(&e1,&e2);
|
||||||
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
||||||
return(s1);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "get_put.h"
|
#include "get_put.h"
|
||||||
|
|
||||||
#define OFF ((FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
|
#define OFF ((FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
|
||||||
SINGLE
|
void
|
||||||
ngf4(f)
|
ngf4(f)
|
||||||
SINGLE f;
|
SINGLE f;
|
||||||
{
|
{
|
||||||
|
@ -24,5 +24,4 @@ SINGLE f;
|
||||||
p = (unsigned char *) &f + OFF;
|
p = (unsigned char *) &f + OFF;
|
||||||
*p ^= 0x80;
|
*p ^= 0x80;
|
||||||
}
|
}
|
||||||
return f;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))
|
#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)
|
ngf8(f)
|
||||||
DOUBLE f;
|
DOUBLE f;
|
||||||
{
|
{
|
||||||
|
@ -25,5 +25,4 @@ DOUBLE f;
|
||||||
p = (unsigned char *) &f + OFF;
|
p = (unsigned char *) &f + OFF;
|
||||||
*p ^= 0x80;
|
*p ^= 0x80;
|
||||||
}
|
}
|
||||||
return f;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,17 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
SINGLE
|
void
|
||||||
sbf4(s2,s1)
|
sbf4(s2,s1)
|
||||||
SINGLE s1,s2;
|
SINGLE s1,s2;
|
||||||
{
|
{
|
||||||
SINGLE *result = &s1; /* s1 may not be in a register! */
|
EXTEND e1,e2;
|
||||||
|
|
||||||
if (s2 == (SINGLE) 0) {
|
if (s2 == (SINGLE) 0) {
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
s2 = ngf4(s2);
|
extend(&s1,&e1,sizeof(SINGLE));
|
||||||
*result = adf4(s2,s1);
|
extend(&s2,&e2,sizeof(SINGLE));
|
||||||
return(s1); /* add and return result */
|
sub_ext(&e1,&e2);
|
||||||
|
compact(&e1,&s1,sizeof(SINGLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,17 @@
|
||||||
|
|
||||||
#include "FP_types.h"
|
#include "FP_types.h"
|
||||||
|
|
||||||
DOUBLE
|
void
|
||||||
sbf8(s2,s1)
|
sbf8(s2,s1)
|
||||||
DOUBLE s1,s2;
|
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) {
|
if (s2.d[0] == 0 && s2.d[1] == 0) {
|
||||||
return s1;
|
return;
|
||||||
}
|
}
|
||||||
s2 = ngf8(s2);
|
extend(&s1.d[0],&e1,sizeof(DOUBLE));
|
||||||
*result = adf8(s2,s1); /* add and return result */
|
extend(&s2.d[0],&e2,sizeof(DOUBLE));
|
||||||
return(s1);
|
sub_ext(&e1,&e2);
|
||||||
|
compact(&e1,&s1.d[0],sizeof(DOUBLE));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue