Add num_bytes() to bitfield

This commit is contained in:
Paul Hauner 2018-09-22 21:58:54 +10:00
parent 78de4e43e2
commit 890aaf7335
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -86,6 +86,9 @@ impl BooleanBitfield {
/// vector.
pub fn is_empty(&self) -> bool { self.len == 0 }
/// The number of bytes required to represent the bitfield.
pub fn num_bytes(&self) -> usize { self.vec.len() }
/// Iterate through the underlying vector and count the number of
/// true bits.
pub fn num_true_bits(&self) -> u64 {