From 0a505634179bfb29c3743895944d471888a1996c Mon Sep 17 00:00:00 2001 From: das Date: Mon, 16 Feb 2004 10:02:40 +0000 Subject: Fix some aliasing problems. --- lib/libc/i386/gen/isinf.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'lib/libc/i386/gen') 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 +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); } -- cgit v1.1