summaryrefslogtreecommitdiffstats
path: root/lib/libc/powerpc
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/powerpc
parent3d4d791def4351d25fc09fcce478ff1e8d14bbbd (diff)
downloadFreeBSD-src-0a505634179bfb29c3743895944d471888a1996c.zip
FreeBSD-src-0a505634179bfb29c3743895944d471888a1996c.tar.gz
Fix some aliasing problems.
Diffstat (limited to 'lib/libc/powerpc')
-rw-r--r--lib/libc/powerpc/gen/isinf.c20
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);
}
OpenPOWER on IntegriCloud