-
Notifications
You must be signed in to change notification settings - Fork 305
Add array constants #504
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
Add array constants #504
Conversation
src/constants.rs
Outdated
| pub const ZERO: [u8; 32] = [ | ||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| ]; |
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.
[0; 32] is much shorter :)
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.
lol, so it is :) Will use as suggested.
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.
Will let you fix this before merging
apoelstra
left a comment
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.
ACK 6fa2962
In multiple places we use array constants for zero and one. Add two constants and use them throughout the codebase. Note the endian-ness of `ONE` in the docs.
|
Force pushed change to declaration of |
6fa2962 to
603f441
Compare
apoelstra
left a comment
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.
ACK 603f441
e0e575d Run cargo fmt (Tobin C. Harding) 41449e4 Prepare codebase for formatting (Tobin C. Harding) 7e3c893 Introduce rustfmt config file (Tobin C. Harding) Pull request description: (Includes the patch from #504, I pulled it out of this to merge faster) Introduce `rustfmt` by doing: - Copy the `rustfmt` config file from `rust-bitcoin` - Prepare the codebase by adding `#[rustfmt::skip]` as needed and doing some manual format improvements. - Run the formatter: `cargo +nightly fmt` - Add formatting checks to CI and the pre-commit hook Thanks in advance for doing the painful review on patch 3. ACKs for top commit: apoelstra: ACK e0e575d Tree-SHA512: 1b6fdbaf81480c0446e660cc3f6ab7ac0697f272187f6fdfd6b95d894a418cde8cf1c423f1d18ebbe03ac5c43489630a35ad07912afaeb6107cfbe7338a9bed7
603f441548fb198c07bd9bcb5b0c979a536bc6cb Add array constants (Tobin C. Harding)
Pull request description:
In multiple places we use array constants for zero and one. Add two constants and use them throughout the codebase. Note the endian-ness of `ONE` in the docs.
ACKs for top commit:
apoelstra:
ACK 603f441548fb198c07bd9bcb5b0c979a536bc6cb
Tree-SHA512: 70c455ee42f8a04feec37c3963b030c0f2c07b83801caf818dbb1661b7a0f65c4b92ff6a5df496a4dd6a917d13af4d60624a072c6f8a083293db9cd80d194232
603f441548fb198c07bd9bcb5b0c979a536bc6cb Add array constants (Tobin C. Harding)
Pull request description:
In multiple places we use array constants for zero and one. Add two constants and use them throughout the codebase. Note the endian-ness of `ONE` in the docs.
ACKs for top commit:
apoelstra:
ACK 603f441548fb198c07bd9bcb5b0c979a536bc6cb
Tree-SHA512: 70c455ee42f8a04feec37c3963b030c0f2c07b83801caf818dbb1661b7a0f65c4b92ff6a5df496a4dd6a917d13af4d60624a072c6f8a083293db9cd80d194232
In multiple places we use array constants for zero and one. Add two constants and use them throughout the codebase. Note the endian-ness of
ONEin the docs.