From a6c75e969d1199102dcb1759b4ce34ace64b25db Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 29 Sep 2021 23:58:34 +0900 Subject: [PATCH] [ELF] Refactor --- mold.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; };