From ea9332362d860b2ced5370fc7fbfbb5812b33ee6 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 26 Jun 1991 17:26:59 +0000 Subject: [PATCH] correction --- modules/src/flt_arith/flt_ar2flt.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/src/flt_arith/flt_ar2flt.c b/modules/src/flt_arith/flt_ar2flt.c index c1cb7b2a4..4fe418674 100644 --- a/modules/src/flt_arith/flt_ar2flt.c +++ b/modules/src/flt_arith/flt_ar2flt.c @@ -21,10 +21,22 @@ flt_arith2flt(n, e, uns) } else e->flt_sign = 0; if (sizeof(arith) == 4) { - e->m1 = n; e->m2 = 0; - } else { - e->m1 = (n >> (sizeof(arith)*8 - 32)) & 0xFFFFFFFF; - e->m2 = n << 32; + if (n < 0) { + e->m1 = 1; e->m2 = 0; + } + else { + e->m1 = 0; e->m2 = n; + } + } + else { + if (n < 0) { + e->m2 = 0; + e->m1 = (1 << (sizeof(arith)*8-32)); + } + else { + e->m2 = n & 0xffffffffL; + e->m1 = (n >> 32); + } } if (n == 0) { e->flt_exp = 0;