diff options
author | des <des@FreeBSD.org> | 2004-03-16 20:42:02 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-03-16 20:42:02 +0000 |
commit | ce346529a392bdc70b527967b64de371a411c397 (patch) | |
tree | 6f573f40ecc689ac27427614841b8f02fedfd30e /lib/libc/alpha/gen/fpgetround.c | |
parent | ffa157ec1e6e53fb7cdd4737c35288e138bb357d (diff) | |
download | FreeBSD-src-ce346529a392bdc70b527967b64de371a411c397.zip FreeBSD-src-ce346529a392bdc70b527967b64de371a411c397.tar.gz |
Use unions to avoid violating C99 strict aliasing rules.
Diffstat (limited to 'lib/libc/alpha/gen/fpgetround.c')
-rw-r--r-- | lib/libc/alpha/gen/fpgetround.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libc/alpha/gen/fpgetround.c b/lib/libc/alpha/gen/fpgetround.c index 70de648..1fd96b2 100644 --- a/lib/libc/alpha/gen/fpgetround.c +++ b/lib/libc/alpha/gen/fpgetround.c @@ -41,11 +41,12 @@ __FBSDID("$FreeBSD$"); fp_rnd_t fpgetround() { - double fpcrval; - u_int64_t old; + union { + double fpcrval; + u_int64_t intval; + } u; - GET_FPCR(fpcrval); - old = *(u_int64_t *)&fpcrval; + GET_FPCR(u.fpcrval); - return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT); + return ((u.intval & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT); } |