[Issue 18134] New: BitArray <<= broken when length % 32 = 0
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 27 21:34:21 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18134
Issue ID: 18134
Summary: BitArray <<= broken when length % 32 = 0
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: simen.kjaras at gmail.com
unittest
{
import std.bitmanip : BitArray;
import std.range : repeat;
import std.array : array;
BitArray ba = true.repeat(64).array;
ba >>= 1;
assert((cast(uint[])ba)[$-1] == 0x7FFF_FFFF);
}
When a BitArray covers exactly 32, 64, 96 and so on number of bits, the bit
shifting operation fills the last word with zeroes. The test above should pass,
but doesn't.
--
More information about the Digitalmars-d-bugs
mailing list