OSDN Git Service

2010-09-18 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / fixed-value.c
index 26aaa02..8378b9a 100644 (file)
@@ -1,5 +1,5 @@
 /* Fixed-point arithmetic support.
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -22,8 +22,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "diagnostic-core.h"
 #include "toplev.h"
-#include "fixed-value.h"
 
 /* Compare two fixed objects for bitwise identity.  */
 
@@ -68,7 +68,7 @@ check_real_for_fixed_mode (REAL_VALUE_TYPE *real_value, enum machine_mode mode)
   real_2expN (&epsilon_value, -GET_MODE_FBIT (mode), mode);
 
   if (SIGNED_FIXED_POINT_MODE_P (mode))
-    min_value = REAL_VALUE_NEGATE (max_value);
+    min_value = real_value_negate (&max_value);
   else
     real_from_string (&min_value, "0.0");
 
@@ -295,6 +295,8 @@ do_fixed_add (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
   double_int temp;
   int i_f_bits;
 
+  /* This was a conditional expression but it triggered a bug in
+     Sun C 5.5.  */
   if (subtract_p)
     temp = double_int_neg (b->data);
   else
@@ -360,7 +362,7 @@ do_fixed_add (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
                  double_int one;
                  one.low = 1;
                  one.high = 0;
-                 f->data = double_int_add (f->data, double_int_neg (one));
+                 f->data = double_int_sub (f->data, one);
                }
            }
          else
@@ -442,12 +444,12 @@ do_fixed_multiply (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
       temp1.high = 0;
       r = double_int_add (r, temp1);
 
-      /* We need to add neg(b) to r, if a < 0.  */
+      /* We need to subtract b from r, if a < 0.  */
       if (!unsigned_p && a->data.high < 0)
-       r = double_int_add (r, double_int_neg (b->data));
-      /* We need to add neg(a) to r, if b < 0.  */
+       r = double_int_sub (r, b->data);
+      /* We need to subtract a from r, if b < 0.  */
       if (!unsigned_p && b->data.high < 0)
-       r = double_int_add (r, double_int_neg (a->data));
+       r = double_int_sub (r, a->data);
 
       /* Shift right the result by FBIT.  */
       if (GET_MODE_FBIT (f->mode) == 2 * HOST_BITS_PER_WIDE_INT)
@@ -587,7 +589,7 @@ do_fixed_divide (FIXED_VALUE_TYPE *f, const FIXED_VALUE_TYPE *a,
                         &quo_s.low, &quo_s.high, 0);
 
          /* Try to calculate (mod - pos_b).  */
-         temp = double_int_add (mod, double_int_neg (pos_b));
+         temp = double_int_sub (mod, pos_b);
 
          if (leftmost_mod == 1 || double_int_cmp (mod, pos_b, 1) != -1)
            {
@@ -782,7 +784,7 @@ bool
 fixed_compare (int icode, const FIXED_VALUE_TYPE *op0,
               const FIXED_VALUE_TYPE *op1)
 {
-  enum tree_code code = icode;
+  enum tree_code code = (enum tree_code) icode;
   gcc_assert (op0->mode == op1->mode);
 
   switch (code)