diff options
Diffstat (limited to 'src/bun.js/bindings/JSReadableState.h')
-rw-r--r-- | src/bun.js/bindings/JSReadableState.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/bun.js/bindings/JSReadableState.h b/src/bun.js/bindings/JSReadableState.h index 544d4b63e..c67baebad 100644 --- a/src/bun.js/bindings/JSReadableState.h +++ b/src/bun.js/bindings/JSReadableState.h @@ -11,7 +11,8 @@ class JSReadableState : public JSC::JSDestructibleObject { public: JSReadableState(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure), m_paused(0) + : Base(vm, structure) + , m_paused(0) { } @@ -46,7 +47,7 @@ public: void finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject, bool isDuplex, JSObject* options); static void destroy(JSCell*) {} - enum Mask { + enum Mask : uint32_t { objectMode = 1 << 0, emitClose = 1 << 1, autoDestroy = 1 << 2, @@ -57,7 +58,7 @@ public: sync = 1 << 7, needReadable = 1 << 8, emittedReadable = 1 << 9, - readableListening = 1<< 10, + readableListening = 1 << 10, resumeScheduled = 1 << 11, errorEmitted = 1 << 12, destroyed = 1 << 13, @@ -68,19 +69,17 @@ public: dataEmitted = 1 << 18, }; - bool getBool(Mask mask) { return m_bools & mask; } - void setBool(Mask mask, bool val) { - if (val) - m_bools = m_bools | mask; - else - m_bools = m_bools & mask; + constexpr bool getBool(Mask mask) { return m_bools.contains(mask); } + constexpr void setBool(Mask mask, bool val) + { + m_bools.set(mask, val); } // 0 for null, 1 for true, -1 for false int8_t m_paused = 0; int8_t m_flowing = 0; - uint32_t m_bools = Mask::constructed | Mask::sync; + WTF::OptionSet<Mask> m_bools; int64_t m_length = 0; int64_t m_highWaterMark; |