[Issue 18133] New: BitArray prints bits in wrong order

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 27 21:21:04 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18133

          Issue ID: 18133
           Summary: BitArray prints bits in wrong order
           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.format : format;
    enum input = "0b11001111_11010010";
    auto ba = BitArray([mixin(input)], 16);
    assert(format("0b%b", ba) == input);
}

Since D has binary literals, it's non-intuitive and thus bug-prone that the
output of BitArray.toString prints the bits in the opposite order that's used
in said literals.

--


More information about the Digitalmars-d-bugs mailing list