Skip to content

Commit

Permalink
Merge remote-tracking branch 'Mododo/bitstring_tail'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Aug 17, 2023
2 parents 05281df + 9905b4e commit f181423
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ impl std::fmt::Display for Bitstring<'_> {
}

if let Some(mut last_byte) = last_byte {
let tag = if rem % 4 != 0 { "_" } else { "" };
let rem = 1 + (rem >> 2) as usize;
let tag = if rem != 4 { "_" } else { "" };
let rem = 1 + (rem > 4) as usize;
if rem == 1 {
last_byte >>= 4;
}
Expand Down Expand Up @@ -298,6 +298,16 @@ mod tests {

#[test]
fn bitstring_zero_char_with_completion_tag() {
assert_eq!(
format!(
"{}",
Bitstring {
bytes: &[0b_0011_0000],
bit_len: 4
}
),
format!("{:x}", 0b_0011)
);
assert_eq!(
format!(
"{}",
Expand Down

0 comments on commit f181423

Please sign in to comment.