Patch: FYI: PR 31646

Tom Tromey tromey@redhat.com
Mon Apr 23 16:14:00 GMT 2007


I'm checking this in on the trunk and the RH 4.1 branch.

This fixes an ugly bug in Arrays.qsort.

Tom

Index: ChangeLog
from  Jeroen Frijters  <jeroen@frijters.net>

	PR classpath/31646:
	* java/util/Arrays.java (qsort): Corrected initial median calculation.

Index: java/util/Arrays.java
===================================================================
--- java/util/Arrays.java	(revision 123959)
+++ java/util/Arrays.java	(working copy)
@@ -1040,7 +1040,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -1204,7 +1204,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -1368,7 +1368,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -1544,7 +1544,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -1720,7 +1720,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -1890,7 +1890,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 
@@ -2060,7 +2060,7 @@
       }
 
     // Determine a good median element.
-    int mid = count / 2;
+    int mid = from + count / 2;
     int lo = from;
     int hi = from + count - 1;
 



More information about the Java-patches mailing list