* mips.h: Correct comment typo.
[binutils-gdb.git] / libiberty / copysign.c
index 0b5f8c3d9df866c5cc52ce0ad2ab8760aa72ba04..5c48a5422eba5a820ea4c3c09a7a0f8f8d43c03c 100644 (file)
@@ -129,6 +129,7 @@ typedef union
 } __ieee_float_shape_type;
 #endif
 
+#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
 
 double DEFUN(copysign, (x, y), double x AND double y)
 {
@@ -138,3 +139,14 @@ double DEFUN(copysign, (x, y), double x AND double y)
   a.number.sign =b.number.sign;
   return a.value;
 }
+
+#else
+
+double DEFUN(copysign, (x, y), double x AND double y)
+{
+  if ((x < 0 && y > 0) || (x > 0 && y < 0))
+    return -x;
+  return x;
+}
+
+#endif