diff options
Diffstat (limited to 'lib/libc/powerpc/gen/isinf.c')
-rw-r--r-- | lib/libc/powerpc/gen/isinf.c | 20 |
1 files changed, 14 insertions, 6 deletions
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); } |