Author: alanmc
Date: 2006-12-04 11:58:09 -0500 (Mon, 04 Dec 2006)
New Revision: 68970

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/BitField.cs
Log:
BugFix for SetAll (not that i've found a use for it yet...)

Modified: trunk/bitsharp/src/MonoTorrent.Client/BitField.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/BitField.cs   2006-12-04 16:51:34 UTC 
(rev 68969)
+++ trunk/bitsharp/src/MonoTorrent.Client/BitField.cs   2006-12-04 16:58:09 UTC 
(rev 68970)
@@ -243,19 +243,23 @@
         internal void SetAll(bool value)
         {
             if (value)
+            {
                 for (int i = 0; i < this.array.Length; i++)
                     this.array[i] = ~0;
+                this.trueCount = this.length;
+            }
 
             else
+            {
                 for (int i = 0; i < this.array.Length; i++)
                     this.array[i] = 0;
+                this.trueCount = 0;
+            }
 
             // clear out the remaining space
             int end = ((int)((this.length + 31) / 32)) * 32;
             for (int i = this.length; i < end; ++i)
                 this.array[i >> 5] &= ~(1 << (i & 31));
-
-            this.trueCount = this.length;
         }
         
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to