summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/gen
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2004-02-16 10:02:40 +0000
committerdas <das@FreeBSD.org>2004-02-16 10:02:40 +0000
commit0a505634179bfb29c3743895944d471888a1996c (patch)
tree28236bec651e918042d6ae062eb49a4f35ac208d /lib/libc/i386/gen
parent3d4d791def4351d25fc09fcce478ff1e8d14bbbd (diff)
downloadFreeBSD-src-0a505634179bfb29c3743895944d471888a1996c.zip
FreeBSD-src-0a505634179bfb29c3743895944d471888a1996c.tar.gz
Fix some aliasing problems.
Diffstat (limited to 'lib/libc/i386/gen')
-rw-r--r--lib/libc/i386/gen/isinf.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/libc/i386/gen/isinf.c b/lib/libc/i386/gen/isinf.c
index d894b4f..0d9cd86 100644
--- a/lib/libc/i386/gen/isinf.c
+++ b/lib/libc/i386/gen/isinf.c
@@ -41,30 +41,35 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
+struct IEEEdp {
+ u_int manl : 32;
+ u_int manh : 20;
+ u_int exp : 11;
+ u_int sign : 1;
+};
+
int
isnan(d)
double d;
{
- register struct IEEEdp {
- u_int manl : 32;
- u_int manh : 20;
- u_int exp : 11;
- u_int sign : 1;
- } *p = (struct IEEEdp *)&d;
+ union {
+ double v;
+ struct IEEEdp s;
+ } u;
- return(p->exp == 2047 && (p->manh || p->manl));
+ u.v = d;
+ return (u.s.exp == 2047 && (u.s.manh || u.s.manl));
}
int
isinf(d)
double d;
{
- register struct IEEEdp {
- u_int manl : 32;
- u_int manh : 20;
- u_int exp : 11;
- u_int sign : 1;
- } *p = (struct IEEEdp *)&d;
+ union {
+ double v;
+ struct IEEEdp s;
+ } u;
- return(p->exp == 2047 && !p->manh && !p->manl);
+ u.v = d;
+ return (u.s.exp == 2047 && !u.s.manh && !u.s.manl);
}
OpenPOWER on IntegriCloud