From 08d76a9d566c4a0317df3676d6e84b2e54508e95 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 21 Jun 2022 09:00:20 +0100 Subject: [PATCH] Added size_bits() to bit_stream reader --- include/etl/bit_stream.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 23b82dbf..6475ce3e 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -1198,13 +1198,21 @@ namespace etl } //*************************************************************************** - /// Returns the number of bytes used in the stream. + /// Returns the number of bytes in the stream buffer. //*************************************************************************** size_t size_bytes() const { return length_chars; } + //*************************************************************************** + /// Returns the number of bits in the stream buffer. + //*************************************************************************** + size_t size_bits() const + { + return length_chars * CHAR_BIT; + } + //*************************************************************************** /// Returns start of the stream. //***************************************************************************