[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.14,1.15
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.14,1.15 |
Date: |
Sat, 14 Dec 2002 22:19:46 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv9884/runtime/System
Modified Files:
Array.cs
Log Message:
Fix the pivot values in the quicksort implementations within Array and
ArrayList.
Index: Array.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Array.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** Array.cs 27 Nov 2002 04:20:28 -0000 1.14
--- Array.cs 15 Dec 2002 03:19:43 -0000 1.15
***************
*** 1037,1042 ****
if(lower < upper)
{
! // Partition the array.
testKey = keys.GetValue(upper);
i = lower - 1;
j = upper;
--- 1037,1067 ----
if(lower < upper)
{
! // If this[lower] > this[upper], then swap. This
! // helps to make the loops below terminate predictably.
testKey = keys.GetValue(upper);
+ valuei = keys.GetValue(lower);
+ if(comparer != null)
+ {
+ cmp = comparer.Compare(valuei, testKey);
+ }
+ else
+ {
+ cmp = ((IComparable)valuei).CompareTo(testKey);
+ }
+ if(cmp > 0)
+ {
+ keys.SetValue(valuei, upper);
+ keys.SetValue(testKey, lower);
+ testKey = valuei;
+ if(items != null)
+ {
+ valuei = items.GetValue(lower);
+ valuej = items.GetValue(upper);
+ items.SetValue(valuej, lower);
+ items.SetValue(valuei, upper);
+ }
+ }
+
+ // Partition the array.
i = lower - 1;
j = upper;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.14,1.15,
Rhys Weatherley <address@hidden> <=