1989-07-10 11:17:19 +00:00
|
|
|
/*
|
|
|
|
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Header$ */
|
|
|
|
|
1991-02-19 13:53:04 +00:00
|
|
|
#include "flt_misc.h"
|
1989-07-10 11:17:19 +00:00
|
|
|
#include <em_arith.h>
|
|
|
|
|
1989-11-27 17:25:55 +00:00
|
|
|
flt_arith2flt(n, e, uns)
|
1989-07-10 11:17:19 +00:00
|
|
|
register arith n;
|
|
|
|
register flt_arith *e;
|
|
|
|
{
|
|
|
|
/* Convert the arith "n" to a flt_arith "e".
|
|
|
|
*/
|
|
|
|
|
1989-11-27 17:25:55 +00:00
|
|
|
if (!uns && n < 0) {
|
1989-07-10 11:17:19 +00:00
|
|
|
e->flt_sign = 1;
|
|
|
|
n = -n;
|
|
|
|
}
|
|
|
|
else e->flt_sign = 0;
|
1991-03-11 14:38:28 +00:00
|
|
|
if (sizeof(arith) == 4) {
|
1991-10-02 15:20:22 +00:00
|
|
|
e->m1 = 0; e->m2 = n;
|
1991-06-26 17:26:59 +00:00
|
|
|
}
|
|
|
|
else {
|
1991-10-02 15:20:22 +00:00
|
|
|
e->m2 = n & 0xffffffffL;
|
|
|
|
n >>= 1;
|
|
|
|
n &= ~((arith) 1 << (8*sizeof(arith)-1));
|
|
|
|
e->m1 = (n >> 31);
|
1991-02-26 15:46:18 +00:00
|
|
|
}
|
1989-10-19 14:50:52 +00:00
|
|
|
if (n == 0) {
|
|
|
|
e->flt_exp = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
e->flt_exp = 63;
|
1989-11-27 17:25:55 +00:00
|
|
|
|
1989-07-10 11:17:19 +00:00
|
|
|
flt_status = 0;
|
|
|
|
flt_nrm(e);
|
|
|
|
}
|