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