July 26, 2022

Hi,

Is it necessary to open a PR for problems with the website? For example, part 2 of the first example is out of scope:

https://dlang.org/library/std/bitmanip/bit_array.this.html

I made the out of scope example more readable but who will update it?

void main()
{
    import std.bitmanip;
    import std.stdio;
    import std.algorithm.comparison : equal;
    import std.array : array;
    import std.range : iota, repeat;

    BitArray a = true.repeat(70).array;
    writeln(a.length); // 70
    assert(a.bitsSet.equal(iota(0, 70)));

    size_t[] source = [1, 2, 3, 3424234, 724398, 230947, 389492];
    enum sbits = size_t.sizeof * 8;
    auto ba = BitArray(source, source.length * sbits);
    foreach (n; 0 .. source.length * sbits)
    {
        const mask = 1L << (n % sbits);
        const index = n / sbits;
        auto nth_bit = source[index] & mask;
        assert(ba[n] == cast(bool)nth_bit);
    }
}

SDB@79

July 26, 2022

On Tuesday, 26 July 2022 at 07:26:36 UTC, Salih Dincer wrote:

>

Hi,

Is it necessary to open a PR for problems with the website? For example, part 2 of the first example is out of scope:

The examples are just in the unittest blocks of the phobos source (https://github.com/dlang/phobos/blob/v2.100.1/std/bitmanip.d#L1041 for the one you mentioned, i think) and some tool turns them into the web doc. So, to fix it, just to make a PR to phobos.