dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.15,1.16


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.15,1.16
Date: Mon, 16 Dec 2002 18:31:05 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv30777/runtime/System

Modified Files:
        Array.cs 
Log Message:


Temporarily replace quicksort with a dumb sort, so that we have something
that works, until such time that we can figure out what is wrong with the
partitioning code.


Index: Array.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Array.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** Array.cs    15 Dec 2002 03:19:43 -0000      1.15
--- Array.cs    16 Dec 2002 23:31:03 -0000      1.16
***************
*** 1031,1034 ****
--- 1031,1069 ----
                                                         IComparer comparer)
        {
+               // Temporary hack - use a dumb sort until I can figure
+               // out what is wrong with the Quicksort code -- Rhys.
+               int i, j, cmp;
+               Object valuei;
+               Object valuej;
+               for(i = lower; i < upper; ++i)
+               {
+                       for(j = i + 1; j <= upper; ++j)
+                       {
+                               valuei = keys.GetValue(i);
+                               valuej = keys.GetValue(j);
+                               if(comparer != null)
+                               {
+                                       cmp = comparer.Compare(valuei, valuej);
+                               }
+                               else
+                               {
+                                       cmp = 
((IComparable)valuei).CompareTo(valuej);
+                               }
+                               if(cmp > 0)
+                               {
+                                       keys.SetValue(valuej, i);
+                                       keys.SetValue(valuei, j);
+                                       if(items != null)
+                                       {
+                                               valuei = items.GetValue(i);
+                                               valuej = items.GetValue(j);
+                                               items.SetValue(valuej, i);
+                                               items.SetValue(valuei, j);
+                                       }
+                               }
+                       }
+               }
+ 
+ #if false
                int i, j, cmp;
                Object testKey;
***************
*** 1126,1129 ****
--- 1161,1165 ----
                        InnerSort(keys, items, i + 1, upper, comparer);
                }
+ #endif
        }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]