[cp-patches] Patch: FYI: PR 27888

Tom Tromey tromey at redhat.com
Fri Jun 9 16:58:06 UTC 2006


I'm checking this in.

This is Anthony's patch for PR 27888, plus an additional bit for
Collections and GapContent.  (The latter is probably not needed but
is included just to be complete.)

I also looked at the other possible failures -- BitSet, opentype,
Character -- but none of these needed changes.

Tom

2006-06-09  Anthony Green  <green at redhat.com>

	PR classpath/27888:
	* javax/swing/text/GapContent.java (binarySearch): Use unsigned shift.
	* java/util/Collections.java (binarySearch): Use unsigned shift.
	* java/util/Arrays.java (binarySearch): Use unsigned shift.

Index: java/util/Arrays.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Arrays.java,v
retrieving revision 1.28
diff -u -r1.28 Arrays.java
--- java/util/Arrays.java	7 Apr 2006 19:45:46 -0000	1.28
+++ java/util/Arrays.java	9 Jun 2006 16:58:34 -0000
@@ -97,7 +97,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final byte d = a[mid];
         if (d == key)
           return mid;
@@ -131,7 +131,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final char d = a[mid];
         if (d == key)
           return mid;
@@ -165,7 +165,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final short d = a[mid];
         if (d == key)
           return mid;
@@ -199,7 +199,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final int d = a[mid];
         if (d == key)
           return mid;
@@ -233,7 +233,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final long d = a[mid];
         if (d == key)
           return mid;
@@ -268,7 +268,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final int r = Float.compare(a[mid], key);
         if (r == 0)
           return mid;
@@ -303,7 +303,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final int r = Double.compare(a[mid], key);
         if (r == 0)
           return mid;
@@ -369,7 +369,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final int d = Collections.compare(key, a[mid], c);
         if (d == 0)
           return mid;
Index: java/util/Collections.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Collections.java,v
retrieving revision 1.41
diff -u -r1.41 Collections.java
--- java/util/Collections.java	11 May 2006 07:56:42 -0000	1.41
+++ java/util/Collections.java	9 Jun 2006 16:58:35 -0000
@@ -655,7 +655,7 @@
 	boolean forward = true;
         while (low <= hi)
           {
-            pos = (low + hi) >> 1;
+            pos = (low + hi) >>> 1;
             if (i < pos)
 	      {
 		if (!forward)
@@ -684,7 +684,7 @@
       {
 	while (low <= hi)
 	  {
-	    pos = (low + hi) >> 1;
+	    pos = (low + hi) >>> 1;
 	    final int d = compare(l.get(pos), key, c);
 	    if (d == 0)
               return pos;
Index: javax/swing/text/GapContent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/GapContent.java,v
retrieving revision 1.49
diff -u -r1.49 GapContent.java
--- javax/swing/text/GapContent.java	5 Jun 2006 11:44:50 -0000	1.49
+++ javax/swing/text/GapContent.java	9 Jun 2006 16:58:35 -0000
@@ -918,7 +918,7 @@
     int mid = 0;
     while (low <= hi)
       {
-        mid = (low + hi) >> 1;
+        mid = (low + hi) >>> 1;
         final int d = a[mid];
         if (d == key)
           return mid;



More information about the Classpath-patches mailing list