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/powerpc/gen/isinf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lib/libc/powerpc') diff --git a/lib/libc/powerpc/gen/isinf.c b/lib/libc/powerpc/gen/isinf.c index fb6d73b..0b9ef6c 100644 --- a/lib/libc/powerpc/gen/isinf.c +++ b/lib/libc/powerpc/gen/isinf.c @@ -43,17 +43,25 @@ __FBSDID("$FreeBSD$"); int isnan(double d) { - struct ieee_double *p = (struct ieee_double *)&d; + union { + double v; + struct ieee_double s; + } u; - return (p->dbl_exp == DBL_EXP_INFNAN && - (p->dbl_frach || p->dbl_fracl)); + u.v = d; + return (u.s.dbl_exp == DBL_EXP_INFNAN && + (u.s.dbl_frach || u.s.dbl_fracl)); } int isinf(double d) { - struct ieee_double *p = (struct ieee_double *)&d; + union { + double v; + struct ieee_double s; + } u; - return (p->dbl_exp == DBL_EXP_INFNAN && - !p->dbl_frach && !p->dbl_fracl); + u.v = d; + return (u.s.dbl_exp == DBL_EXP_INFNAN && + !u.s.dbl_frach && !u.s.dbl_fracl); } -- cgit v1.1