digitalmars.D.bugs - [Issue 11015] New: BitArray.opCom is invalid on 64 bit machines
- d-bugmail puremagic.com (39/39) Sep 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11015
http://d.puremagic.com/issues/show_bug.cgi?id=11015 Summary: BitArray.opCom is invalid on 64 bit machines Product: D Version: unspecified Platform: x86_64 OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: nikolay.v.belov gmail.com --- result.ptr[dim - 1] &= ~(~0 << (len & (bitsPerSizeT-1))); On 64 bit machine 0 - is 32 bit value, but bitsPerSizeT == 64. Need add cast 0 to size_t: result.ptr[dim - 1] &= ~(~cast(size_t)0 << (len & (bitsPerSizeT-1))); Test: foreach (len; 1 .. 256) { foreach (i; 0 .. len) { BitArray a1; a1.length = len; foreach (j; 0 .. len) { a1[j] = true; } a1[i] = false; BitArray a2; a2.length = len; a2[i] = true; BitArray a3 = ~a2; assert(a3 == a1); } } http://d.puremagic.com/issues/show_bug.cgi?id=10948) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 12 2013