This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Patch: FYI: PR 31646


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;
 


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