This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

double_int_scmp issue


Hi All,

  I think we should use unsigned comparison for a.low and b.low
in double_int_scmp().  Thanks!
Ex:
00 01 (high = 00, low = 01)
00 11 (high = 00, low = 11)
00 == 00 and (unsigned) 01 < (unsigned) 11, the function returns -1.

Regards,
Chao-ying

Index: double-int.c
===================================================================
--- double-int.c        (revision 120014)
+++ double-int.c        (working copy)
@@ -363,9 +363,9 @@
     return -1;
   if (a.high > b.high)
     return 1;
-  if ((HOST_WIDE_INT) a.low < (HOST_WIDE_INT) b.low)
+  if (a.low < b.low)
     return -1;
-  if ((HOST_WIDE_INT) a.low > (HOST_WIDE_INT) b.low)
+  if (a.low > b.low)
     return 1;

   return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]