mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-18 21:07:10 +00:00
With RFC 2325 looking close to being accepted, I took a crack at reorganizing this repository to being more amenable for inclusion in libstd/libcore. My current plan is to add stdsimd as a submodule in rust-lang/rust and then use `#[path]` to include the modules directly into libstd/libcore. Before this commit, however, the source code of coresimd/stdsimd themselves were not quite ready for this. Imports wouldn't compile for one reason or another, and the organization was also different than the RFC itself! In addition to moving a lot of files around, this commit has the following major changes: * The `cfg_feature_enabled!` macro is now renamed to `is_target_feature_detected!` * The `vendor` module is now called `arch`. * Under the `arch` module is a suite of modules like `x86`, `x86_64`, etc. One per `cfg!(target_arch)`. * The `is_target_feature_detected!` macro was removed from coresimd. Unfortunately libcore has no ability to export unstable macros, so for now all feature detection is canonicalized in stdsimd. The `coresimd` and `stdsimd` crates have been updated to the planned organization in RFC 2325 as well. The runtime bits saw the largest amount of refactoring, seeing a good deal of simplification without the core/std split.
9 lines
205 B
Rust
9 lines
205 B
Rust
//! Bit manipulation utilities.
|
|
|
|
/// Tests the `bit` of `x`.
|
|
#[allow(dead_code)]
|
|
pub fn test(x: usize, bit: u32) -> bool {
|
|
debug_assert!(bit < 32, "bit index out-of-bounds");
|
|
x & (1 << bit) != 0
|
|
}
|