mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-11-02 05:17:52 +00:00
astc: Delete Bits' copy contstructor and assignment operator
This also potentially avoids warnings, considering the copy assignment operator is supposed to have a return value.
This commit is contained in:
parent
4cd52a34b9
commit
e3fadb9616
1 changed files with 6 additions and 8 deletions
|
@ -105,17 +105,12 @@ private:
|
||||||
|
|
||||||
template <typename IntType>
|
template <typename IntType>
|
||||||
class Bits {
|
class Bits {
|
||||||
private:
|
|
||||||
const IntType& m_Bits;
|
|
||||||
|
|
||||||
// Don't copy
|
|
||||||
Bits() {}
|
|
||||||
Bits(const Bits&) {}
|
|
||||||
Bits& operator=(const Bits&) {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Bits(IntType& v) : m_Bits(v) {}
|
explicit Bits(IntType& v) : m_Bits(v) {}
|
||||||
|
|
||||||
|
Bits(const Bits&) = delete;
|
||||||
|
Bits& operator=(const Bits&) = delete;
|
||||||
|
|
||||||
uint8_t operator[](uint32_t bitPos) {
|
uint8_t operator[](uint32_t bitPos) {
|
||||||
return static_cast<uint8_t>((m_Bits >> bitPos) & 1);
|
return static_cast<uint8_t>((m_Bits >> bitPos) & 1);
|
||||||
}
|
}
|
||||||
|
@ -132,6 +127,9 @@ public:
|
||||||
uint64_t mask = (1 << (end - start + 1)) - 1;
|
uint64_t mask = (1 << (end - start + 1)) - 1;
|
||||||
return (m_Bits >> start) & mask;
|
return (m_Bits >> start) & mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const IntType& m_Bits;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EIntegerEncoding { eIntegerEncoding_JustBits, eIntegerEncoding_Quint, eIntegerEncoding_Trit };
|
enum EIntegerEncoding { eIntegerEncoding_JustBits, eIntegerEncoding_Quint, eIntegerEncoding_Trit };
|
||||||
|
|
Loading…
Reference in a new issue