diff --git a/decoder/src/lib.rs b/decoder/src/lib.rs index efbf520e1..cfd1d2264 100644 --- a/decoder/src/lib.rs +++ b/decoder/src/lib.rs @@ -1604,6 +1604,29 @@ mod tests { ); } + #[test] + fn bitfields_u128() { + let bytes = [ + 0, // index + 2, // timestamp + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + 0b1111_0000, + 0b1110_0101, // u16 + ]; + decode_and_expect("x: {0=119..124:b}", &bytes, "0.000002 INFO x: 0b1011"); + } + #[test] fn slice() { let bytes = [ diff --git a/parser/src/lib.rs b/parser/src/lib.rs index a27633106..f74316590 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -127,7 +127,7 @@ fn parse_range(mut s: &str) -> Option<(Range, usize /* consumed */)> { return None; } - if start >= 32 || end >= 32 { + if start >= 128 || end >= 128 { return None; } @@ -886,10 +886,10 @@ mod tests { assert!(parse("{=0..0}", ParserMode::Strict).is_err()); // start > end assert!(parse("{=1..0}", ParserMode::Strict).is_err()); - // out of 32-bit range - assert!(parse("{=0..32}", ParserMode::Strict).is_err()); - // just inside 32-bit range - assert!(parse("{=0..31}", ParserMode::Strict).is_ok()); + // out of 128-bit range + assert!(parse("{=0..128}", ParserMode::Strict).is_err()); + // just inside 128-bit range + assert!(parse("{=0..127}", ParserMode::Strict).is_ok()); // missing parts assert!(parse("{=0..4", ParserMode::Strict).is_err());