Skip to content

Commit

Permalink
Use docsrs cfg (#115)
Browse files Browse the repository at this point in the history
* Use `cfg(docsrs)` to enable things for docs.rs

* Use `cfg(docsrs)` for detecting docs.rs builds
  • Loading branch information
waywardmonkeys authored Jul 30, 2024
1 parent 131a915 commit e39ea31
Show file tree
Hide file tree
Showing 19 changed files with 770 additions and 770 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ opt-level = 3
[package.metadata.docs.rs]
# This makes docs.rs build with all features enabled and
# also it will indicate what fn needs what cpu feature.
rustdoc-args = ["-C","target-cpu=native","--cfg","docs_rs"]
rustdoc-args = ["-C", "target-cpu=native"]
all-features = true
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::transmute_ptr_to_ptr)]
#![cfg_attr(docs_rs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! A crate that safely exposes arch intrinsics via `#[cfg()]`.
//!
Expand Down Expand Up @@ -283,7 +283,7 @@ submodule!(pub x86_x64 {

/// Turns a round operator token to the correct constant value.
#[macro_export]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "avx")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "avx")))]
macro_rules! round_op {
(Nearest) => {{
#[cfg(target_arch = "x86")]
Expand Down
4 changes: 2 additions & 2 deletions src/x86_x64/adx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::*;
/// `adcx r32, r32`
/// `adox r32, r32`
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "adx")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "adx")))]
pub fn add_carry_u32(c_in: u8, a: u32, b: u32, out: &mut u32) -> u8 {
unsafe { _addcarryx_u32(c_in, a, b, out) }
}
Expand All @@ -25,7 +25,7 @@ pub fn add_carry_u32(c_in: u8, a: u32, b: u32, out: &mut u32) -> u8 {
/// `adcx r64, r64`
/// `adox r64, r64`
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "adx")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "adx")))]
#[cfg(target_arch = "x86_64")]
pub fn add_carry_u64(c_in: u8, a: u64, b: u64, out: &mut u64) -> u8 {
unsafe { _addcarryx_u64(c_in, a, b, out) }
Expand Down
12 changes: 6 additions & 6 deletions src/x86_x64/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::*;
/// * **Assembly:** `aesdec xmm, xmm`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_decrypt_m128i(a: m128i, round_key: m128i) -> m128i {
m128i(unsafe { _mm_aesdec_si128(a.0, round_key.0) })
}
Expand All @@ -20,7 +20,7 @@ pub fn aes_decrypt_m128i(a: m128i, round_key: m128i) -> m128i {
/// * **Assembly:** `aesdeclast xmm, xmm`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_decrypt_last_m128i(a: m128i, round_key: m128i) -> m128i {
m128i(unsafe { _mm_aesdeclast_si128(a.0, round_key.0) })
}
Expand All @@ -31,7 +31,7 @@ pub fn aes_decrypt_last_m128i(a: m128i, round_key: m128i) -> m128i {
/// * **Assembly:** `aesenc xmm, xmm`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_encrypt_m128i(a: m128i, round_key: m128i) -> m128i {
m128i(unsafe { _mm_aesenc_si128(a.0, round_key.0) })
}
Expand All @@ -43,7 +43,7 @@ pub fn aes_encrypt_m128i(a: m128i, round_key: m128i) -> m128i {
/// * **Assembly:** `aesenclast xmm, xmm`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_encrypt_last_m128i(a: m128i, round_key: m128i) -> m128i {
m128i(unsafe { _mm_aesenclast_si128(a.0, round_key.0) })
}
Expand All @@ -54,7 +54,7 @@ pub fn aes_encrypt_last_m128i(a: m128i, round_key: m128i) -> m128i {
/// * **Assembly:** `aesimc xmm, xmm`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_inv_mix_columns_m128i(a: m128i) -> m128i {
m128i(unsafe { _mm_aesimc_si128(a.0) })
}
Expand All @@ -69,7 +69,7 @@ pub fn aes_inv_mix_columns_m128i(a: m128i) -> m128i {
/// * **Assembly:** `aeskeygenassist xmm, xmm, imm8`
#[must_use]
#[inline(always)]
#[cfg_attr(docs_rs, doc(cfg(target_feature = "aes")))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "aes")))]
pub fn aes_key_gen_assist_m128i<const IMM: i32>(a: m128i) -> m128i {
m128i(unsafe { _mm_aeskeygenassist_si128(a.0, IMM) })
}
Expand Down
Loading

0 comments on commit e39ea31

Please sign in to comment.