diff --git a/std/bitmanip.d b/std/bitmanip.d index f8a97dfbf19..1c32e6aeb06 100644 --- a/std/bitmanip.d +++ b/std/bitmanip.d @@ -1176,10 +1176,10 @@ public: } /********************************************** - * Sets the amount of bits in the `BitArray`. + * Sets the number of bits in the `BitArray`. * $(RED Warning: increasing length may overwrite bits in * the final word of the current underlying data regardless - * of whether it is shared between BitArray objects. i.e. D + * of whether it is shared between `BitArray` objects. i.e. D * dynamic array extension semantics are not followed.) */ @property size_t length(size_t newlen) pure nothrow @system @@ -1744,7 +1744,7 @@ public: /*************************************** * Supports comparison operators for `BitArray`. */ - int opCmp(BitArray a2) const @nogc pure nothrow + int opCmp(const BitArray a2) const @nogc pure nothrow { const lesser = this.length < a2.length ? &this : &a2; immutable fullWords = lesser.fullWords; @@ -1791,8 +1791,8 @@ public: bool[] bf = [1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]; bool[] bg = [1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0]; - auto a = BitArray(ba); - auto b = BitArray(bb); + const a = BitArray(ba); + const b = BitArray(bb); auto c = BitArray(bc); auto d = BitArray(bd); auto e = BitArray(be); @@ -2214,7 +2214,7 @@ public: /*************************************** * ditto */ - BitArray opOpAssign(string op)(BitArray b) pure nothrow return scope + BitArray opOpAssign(string op)(const BitArray b) pure nothrow return scope if (op == "~") { auto istart = _len; @@ -2231,7 +2231,7 @@ public: bool[] bb = [0,1,0]; auto a = BitArray(ba); - auto b = BitArray(bb); + const b = BitArray(bb); BitArray c; c = (a ~= b); @@ -2241,7 +2241,6 @@ public: assert(a[2] == 0); assert(a[3] == 1); assert(a[4] == 0); - assert(c == a); } @@ -2273,12 +2272,10 @@ public: } /** ditto */ - BitArray opBinary(string op)(BitArray b) const pure nothrow + BitArray opBinary(string op)(const BitArray b) const pure nothrow if (op == "~") { - BitArray r; - - r = this.dup; + BitArray r = this.dup; r ~= b; return r; } @@ -2289,8 +2286,8 @@ public: bool[] ba = [1,0]; bool[] bb = [0,1,0]; - auto a = BitArray(ba); - auto b = BitArray(bb); + const a = BitArray(ba); + const b = BitArray(bb); BitArray c; c = (a ~ b);