[Issue 10948] New: BitArray.opEquals is invalid

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 1 21:33:37 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10948

           Summary: BitArray.opEquals is invalid
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: nikolay.v.belov at gmail.com


--- Comment #0 from nbelov <nikolay.v.belov at gmail.com> 2013-09-01 21:33:36 PDT ---
Created an attachment (id=1245)
diff with git master

Invalid calculation n value:
-        auto n = this.length / bitsPerSizeT;
+        auto n = (this.length + (bitsPerSizeT - 1)) / bitsPerSizeT;


Test:
//                  0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5
6 7
static bool[] bf =
[1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
static bool[] bg =
[1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];

BitArray f; f.init(bf);
BitArray g; g.init(bg);
assert(f != g);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list