From c774e38ce71b21d70748f6cc945e6fd6b432f43d Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 11 Jun 2018 16:43:30 +0200 Subject: [PATCH] Mark appropriate const fns as promotable --- crates/stdsimd/src/lib.rs | 1 + stdsimd/arch/detect/cache.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/crates/stdsimd/src/lib.rs b/crates/stdsimd/src/lib.rs index aa2e51ce10..9ecf93d5bf 100644 --- a/crates/stdsimd/src/lib.rs +++ b/crates/stdsimd/src/lib.rs @@ -9,6 +9,7 @@ #![feature(const_fn, integer_atomics, staged_api, stdsimd)] #![feature(doc_cfg, allow_internal_unstable)] +#![feature(promotable_const_fn, custom_attributes)] #![cfg_attr(feature = "cargo-clippy", allow(shadow_reuse))] #![cfg_attr(target_os = "linux", feature(linkage))] #![no_std] diff --git a/stdsimd/arch/detect/cache.rs b/stdsimd/arch/detect/cache.rs index 3d6b11d786..2d87ed16fa 100644 --- a/stdsimd/arch/detect/cache.rs +++ b/stdsimd/arch/detect/cache.rs @@ -12,11 +12,13 @@ use core::sync::atomic::AtomicU64; use core::sync::atomic::AtomicU32; /// Sets the `bit` of `x`. +#[promotable_const_fn] pub const fn set_bit(x: u64, bit: u32) -> u64 { x | 1 << bit } /// Tests the `bit` of `x`. +#[promotable_const_fn] pub const fn test_bit(x: u64, bit: u32) -> bool { x & (1 << bit) != 0 }