Skip to content

const-oid: fix encoder for 1.1.1.270000000 #1753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions const-oid/src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ impl<const MAX_SIZE: usize> Encoder<MAX_SIZE> {
/// Compute the length of an arc when encoded in base 128.
const fn base128_len(arc: Arc) -> usize {
match arc {
0..=0x7f => 1,
0x80..=0x3fff => 2,
0x4000..=0x1fffff => 3,
0x200000..=0x1fffffff => 4,
0..=0x7f => 1, // up to 7 bits
0x80..=0x3fff => 2, // up to 14 bits
0x4000..=0x1fffff => 3, // up to 21 bits
0x200000..=0x0fffffff => 4, // up to 28 bits
_ => 5,
}
}
Expand Down
1 change: 1 addition & 0 deletions const-oid/tests/proptests.proptest-regressions
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ cc d90305406041ea5e4cf4d9e7849cad03391db1869d0b1329f60ccbf1fabaee91 # shrinks to
cc 8ed8dde35d12a2c8e10cdde6d591a8f17f0cd6d6fdf90f1582536401364623bf # shrinks to s = "0.00"
cc ba5e3e3dc1a64870477e82054bbf6d8272f8b0d0c9094115bf7e8b5ff59f3c63 # shrinks to s = "00.1.1"
cc d211e943da9a0e3d0ee5097899b2435f784ca2b3d2f8d4790aae3744823a268a # shrinks to s = "1.1.1.60817410.1"
cc 61bdeaa6cfc6707a0c4f3e9c6165d99d28042e78acb29b0ca7f747c169e83e74 # shrinks to s = "1.1.1.270000000"