Browse Source

AK: Add `BigEndianInputBitStream::bits_until_next_byte_boundary()`

Lucas CHOLLET 1 year ago
parent
commit
cbfea68ed8
1 changed files with 1 additions and 0 deletions
  1. 1 0
      AK/BitStream.h

+ 1 - 0
AK/BitStream.h

@@ -111,6 +111,7 @@ public:
 
     /// Whether we are (accidentally or intentionally) at a byte boundary right now.
     ALWAYS_INLINE bool is_aligned_to_byte_boundary() const { return m_bit_offset % 8 == 0; }
+    ALWAYS_INLINE u8 bits_until_next_byte_boundary() const { return m_bit_offset % 8 == 0 ? 0 : 8 - m_bit_offset; }
 
 private:
     Optional<u8> m_current_byte;