From Christos: gdtoa fixes for m68k. M68k ports should build now, but

printing extended precision is a little off.
This commit is contained in:
mhitch 2007-02-17 17:50:52 +00:00
parent 1adc21b497
commit d417d9f5d4
2 changed files with 21 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpclassifyl.c,v 1.1 2003/10/28 22:05:37 kleink Exp $ */
/* $NetBSD: fpclassifyl.c,v 1.2 2007/02/17 17:50:52 mhitch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpclassifyl.c,v 1.1 2003/10/28 22:05:37 kleink Exp $");
__RCSID("$NetBSD: fpclassifyl.c,v 1.2 2007/02/17 17:50:52 mhitch Exp $");
#endif
#include <machine/ieee.h>
@ -58,13 +58,16 @@ __fpclassifyl(long double x)
_DIAGASSERT(u.extu_ext.ext_zero == 0);
if (u.extu_ext.ext_exp == 0 && u.extu_ext.ext_int == 0) {
if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
if (u.extu_ext.ext_exp == 0 &&
(u.extu_ext.ext_frach & 0x80000000) == 0) {
if ((u.extu_ext.ext_frach & 0x7fffffff) == 0 &&
u.extu_ext.ext_fracl == 0)
return FP_ZERO;
else
return FP_SUBNORMAL;
} else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
if ((u.extu_ext.ext_frach & 0x7fffffff) == 0 &&
u.extu_ext.ext_fracl == 0)
return FP_INFINITE;
else
return FP_NAN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee.h,v 1.12 2005/12/11 12:17:53 christos Exp $ */
/* $NetBSD: ieee.h,v 1.13 2007/02/17 17:50:52 mhitch Exp $ */
/*
* Copyright (c) 1992, 1993
@ -50,14 +50,23 @@
#if !defined(__mc68010__) || defined(_KERNEL)
#define EXT_EXPBITS 15
#define EXT_FRACBITS 64
#define EXT_FRACHBITS 32
#define EXT_FRACLBITS 32
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
#define EXT_TO_ARRAY32(u, a) do { \
(a)[0] = (uint32_t)(u).extu_ext.ext_frach; \
(a)[1] = (uint32_t)(u).extu_ext.ext_fracl; \
} while(/*CONSTCOND*/0)
struct ieee_ext {
u_int ext_sign:1;
u_int ext_exp:15;
u_int ext_exp:EXT_EXPBITS;
u_int ext_zero:16;
#if 0
u_int ext_int:1;
u_int ext_frach:31;
#endif
u_int ext_frach;
u_int ext_fracl;
};