diff --git a/mold.h b/mold.h index 27a54927a2..935a24067d 100644 --- a/mold.h +++ b/mold.h @@ -329,7 +329,8 @@ class ConcurrentMap { // class BitVector { - struct BitRef { + class BitRef { + public: BitRef(u8 &byte, u8 bitpos) : byte(byte), bitpos(bitpos) {} BitRef &operator=(bool val) { @@ -340,10 +341,16 @@ class BitVector { return *this; } + BitRef &operator=(const BitRef &other) { + *this = (bool)other; + return *this; + } + operator bool() const { return byte & (1 << bitpos); } + private: u8 &byte; u8 bitpos; };