about summary refs log tree commit diff
path: root/sysdeps/sparc/sparc32/soft-fp/q_neg.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/sparc/sparc32/soft-fp/q_neg.c')
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_neg.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_neg.c b/sysdeps/sparc/sparc32/soft-fp/q_neg.c
index b5049cd6df..5fb7e1aa77 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_neg.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_neg.c
@@ -24,20 +24,25 @@
 
 long double _Q_neg(const long double a)
 {
-  long double c = a;
+  union {
+    long double	ldbl;
+    UWtype	words[4];
+  } c;
+
+  c.ldbl = a;
 
 #if (__BYTE_ORDER == __BIG_ENDIAN)
-  ((UWtype *)&c)[0] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
+  c.words[0] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
 #elif (__BYTE_ORDER == __LITTLE_ENDIAN) && (W_TYPE_SIZE == 64)
-  ((UWtype *)&c)[1] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
+  c.words[1] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
 #elif (__BYTE_ORDER == __LITTLE_ENDIAN) && (W_TYPE_SIZE == 32)
-  ((UWtype *)&c)[3] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
+  c.words[3] ^= (((UWtype)1) << (W_TYPE_SIZE - 1));
 #else
   FP_DECL_Q(A); FP_DECL_Q(C);
 
   FP_UNPACK_RAW_Q(A, a);
   FP_NEG_Q(C, A);
-  FP_PACK_RAW_Q(c, C);
+  FP_PACK_RAW_Q(c.ldbl, C);
 #endif
-  return c;
+  return c.ldbl;
 }