OSDN Git Service

2003-11-26 Michael Koch <konqueror@gmx.de>
[pf3gnuchains/gcc-fork.git] / libiberty / copysign.c
index 0b5f8c3..d288be2 100644 (file)
@@ -129,8 +129,11 @@ 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)
+double
+copysign (x, y)
+     double x, y;
 {
   __ieee_double_shape_type a,b;
   b.value = y;  
@@ -138,3 +141,16 @@ double DEFUN(copysign, (x, y), double x AND double y)
   a.number.sign =b.number.sign;
   return a.value;
 }
+
+#else
+
+double
+copysign (x, y)
+     double x, y;
+{
+  if ((x < 0 && y > 0) || (x > 0 && y < 0))
+    return -x;
+  return x;
+}
+
+#endif