Improve Rust bindings and build tools #26
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR incorporates two changes that have been lurking in
sigp
's fork of BLST that should really live upstream:Eq
trait forPublicKey
andSignature
(resolves Rust bindings: add typical impls #12)build.rs
so it supports the two compilation configurations we want via Cargo features:feature = portable
: for pre-2013 CPUs, disables ADX, turns on__BLST_PORTABLE__
in the C buildfeature = force-adx
: for post-2013 CPUs, enables ADX even if it isn't detected on the hostfeature = default
(no features provided): for all CPUs and source builds, enables ADX if it is present on the hostWe're likely to ship two binaries, one
portable
and oneforce-adx
. The reason for makingforce-adx
its own feature is so we can know when a binary is intended for a modern CPU, and raise an appropriate runtime error if ADX support isn't detected at runtime (instead of justSIGILL
).I also replaced
is_adx
by a call to theis_x86_feature_detected!
macro from the standard library, which is equivalent as far as I understand.