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
Big integers (Uint*) from byte slice array with from_be_bytes
#436
Conversation
Could you please implement this without heap allocations? rust-bitcoin/src/util/endian.rs Line 54 in f4e26ca
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it reads correctly, but I'd be happier with a unit test.
@elichai I did, but it fails to compile since this function is not being used from anywhere (i.e. triggers error: function is never used: `slice_to_u64_be`
--> src/util/endian.rs:4:9
|
4 | pub fn $name(slice: &[u8]) -> $type {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
55 | define_slice_to_be!(slice_to_u64_be, u64);
| ------------------------------------------ in this macro invocation
|
note: the lint level is defined here
--> src/lib.rs:43:9
|
43 | #![deny(dead_code)]
| ^^^^^^^^^
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
I meant that you'll use that instead of: |
Oh yes, true |
done |
Now, with #435 merged, it will be nice to merge this one as well before the next version release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think it could be more readable/idiomatic if it used iterators.
Co-authored-by: Sebastian <geisler.sebastian@googlemail.com>
Btw, trying to understand how Updt: created an issue for that #467 This can be fixed independently from this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
No description provided.