mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
Eliminate a redundent ctor; eliminate one more potential new [0].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -72,25 +72,23 @@ public:
|
|||||||
Bits = NULL;
|
Bits = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BitVector ctor - Creates a bitvector of specified number of bits. All
|
|
||||||
/// bits are initialized to false;
|
|
||||||
BitVector(unsigned s) : Size(s) {
|
|
||||||
Capacity = NumBitWords(s);
|
|
||||||
Bits = new BitWord[Capacity];
|
|
||||||
init_words(Bits, Capacity, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// BitVector ctor - Creates a bitvector of specified number of bits. All
|
/// BitVector ctor - Creates a bitvector of specified number of bits. All
|
||||||
/// bits are initialized to the specified value.
|
/// bits are initialized to the specified value.
|
||||||
BitVector(unsigned s, bool t) : Size(s) {
|
explicit BitVector(unsigned s, bool t = false) : Size(s) {
|
||||||
Capacity = NumBitWords(s);
|
Capacity = NumBitWords(s);
|
||||||
Bits = new BitWord[Capacity];
|
Bits = new BitWord[Capacity];
|
||||||
init_words(Bits, Capacity, t);
|
init_words(Bits, Capacity, t);
|
||||||
clear_unused_bits();
|
if (t)
|
||||||
|
clear_unused_bits();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BitVector copy ctor.
|
/// BitVector copy ctor.
|
||||||
BitVector(const BitVector &RHS) : Size(RHS.size()) {
|
BitVector(const BitVector &RHS) : Size(RHS.size()) {
|
||||||
|
if (Size == 0) {
|
||||||
|
Bits = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Capacity = NumBitWords(RHS.size());
|
Capacity = NumBitWords(RHS.size());
|
||||||
Bits = new BitWord[Capacity];
|
Bits = new BitWord[Capacity];
|
||||||
std::copy(RHS.Bits, &RHS.Bits[Capacity], Bits);
|
std::copy(RHS.Bits, &RHS.Bits[Capacity], Bits);
|
||||||
|
Reference in New Issue
Block a user