[Issue 10948] BitArray.opEquals is invalid

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 5 23:52:39 PDT 2013


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



--- Comment #1 from nbelov <nikolay.v.belov at gmail.com> 2013-09-05 23:52:33 PDT ---
Sorry. It is hasty fix.

Real problem - it is 

size_t mask = (1 << n) - 1;

On 64 bit system size_t has 64 bits.
Byt 1 on this expression it is not size_t, it it 32 bit integer.
And (1 << 32) return 0;

Good fix is

size_t mask = (cast(size_t)1 << n) - 1;


I see this problem on other methods:
- opCmp:
size_t mask = cast(size_t)(1 << j);
must be replaced by
size_t mask = (cast(size_t)1 << j);

-- 
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