[Mono-dev] BitVector32 patch

Scott Peterson lunchtimemama at gmail.com
Wed Aug 6 22:27:20 EDT 2008


OK kids, bad news. There's a bug in the BitVector32 code. The real problem
is, it's buggy in .NET too. Here's a test case:

using System;
using System.Collections.Specialized;

class MainClass  {
    public static void Main (string[] args)  {
        var section1 = BitVector32.CreateSection (32767);
        var section2 = BitVector32.CreateSection (32767, section1);
        var section3 = BitVector32.CreateSection (128, section2);
        var vector = new BitVector32 (0);
        vector[section3] = 128;
        Console.WriteLine(vector[section3]);
    }
}

The output of this program on Mono and .NET is '0'. Obviously this should
throw an exception at the third CreateSection call. If we decides to keep
the buggy behavior for compatibility, we can use a method similar to the one
Laurent mentioned. If we decide to fix the bug, we won't be able to use it
since we'll need to know the length of the mask. I vote for fixing, but I
don't know the protocol for these sorts of things. Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080807/a09b1dce/attachment.html 


More information about the Mono-devel-list mailing list