Skip to content
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

Alternative fes_to_bytes_zeropad with no dropping of last bits #201

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

optout21
Copy link
Contributor

Fixes #198 , as discussed there

@optout21 optout21 force-pushed the fes-to-bytes-zeropad branch 2 times, most recently from b0567fa to 15f6d0e Compare September 18, 2024 11:37
@apoelstra
Copy link
Member

In 15f6d0e:

The change to the doccomment starting with "If the total number of bits" is wrong. (Though I agree this sentence is really long, and if you can break it up somehow, you should.)

Otherwise ack.

CI failure is unrelated and is fixed by #200 (which I will merge shortly, so you will just need to rebase).

@optout21
Copy link
Contributor Author

optout21 commented Sep 18, 2024

The change to the doccomment starting with "If the total number of bits" is wrong. (Though I agree this sentence is really long, and if you can break it up somehow, you should.)

I changed the documentation, made the explanation more detailed.
Let me know if it's OK; should I squash.

    /// Similar to `fes_to_bytes`, but in this variant trailing bits are kept.
    ///
    /// If the last bits do not fill up the last output byte completely, they
    /// are not dropped, but kept, and the last byte is padded with zero bits.
    /// In effect this is the same as if the input was padded with zero values
    /// (1 or 2), such that there are enough zero bits to fill the last byte.
    /// The output is either the same as of `fes_to_bytes`, or has 1 extra byte.

@apoelstra
Copy link
Member

New text looks great! Nah, I wouldn't bother squashing.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 06762e0 successfully ran local tests

@apoelstra
Copy link
Member

Will let @clarkmoody review before merging since this is an API change.

Copy link
Member

@clarkmoody clarkmoody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 06762e0

@apoelstra apoelstra merged commit 7a6d9cc into rust-bitcoin:master Sep 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option for Fe32->bytes conversion (fes_to_bytes) to not drop last partial values
3 participants