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

Improve Rust bindings and build tools #26

Closed

Conversation

michaelsproul
Copy link
Contributor

This PR incorporates two changes that have been lurking in sigp's fork of BLST that should really live upstream:

  • Implement the Eq trait for PublicKey and Signature (resolves Rust bindings: add typical impls #12)
  • Tweak 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 build
    • feature = force-adx: for post-2013 CPUs, enables ADX even if it isn't detected on the host
    • feature = default (no features provided): for all CPUs and source builds, enables ADX if it is present on the host

We're likely to ship two binaries, one portable and one force-adx. The reason for making force-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 just SIGILL).

I also replaced is_adx by a call to the is_x86_feature_detected! macro from the standard library, which is equivalent as far as I understand.

@dot-asm
Copy link
Collaborator

dot-asm commented Sep 13, 2020

Merged. Thanks!

@dot-asm dot-asm closed this Sep 13, 2020
@michaelsproul michaelsproul deleted the rust-binding-improvements branch September 14, 2020 00:45
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.

Rust bindings: add typical impls
3 participants