about summary refs log tree commit diff
path: root/library/stdarch/crates/std_detect/src/detect/bit.rs
diff options
context:
space:
mode:
authorgnzlbg <gonzalobg88@gmail.com>2019-01-21 16:59:10 +0100
committergnzlbg <gnzlbg@users.noreply.github.com>2019-01-22 17:04:25 +0100
commit11c624e488663f4f7554d1f92a072c7caee3908e (patch)
tree0523ed5fac723731d10ef7110a0c36923cb545a2 /library/stdarch/crates/std_detect/src/detect/bit.rs
parent3ca14c6fecdf36ad5c5beca759d2ed7f6a0e1e5f (diff)
downloadrust-11c624e488663f4f7554d1f92a072c7caee3908e.tar.gz
rust-11c624e488663f4f7554d1f92a072c7caee3908e.zip
Refactor stdsimd
This commit:

* renames `coresimd` to `core_arch` and `stdsimd` to `std_detect`

* `std_detect` does no longer depend on `core_arch` - it is a freestanding
  `no_std` library that only depends on `core` - it is renamed to `std_detect`

* moves the top-level coresimd and stdsimd directories into the appropriate
  crates/... directories - this simplifies creating crate.io releases of these crates

* moves the top-level `coresimd` and `stdsimd` sub-directories into their
  corresponding crates in `crates/{core_arch, std_detect}`.
Diffstat (limited to 'library/stdarch/crates/std_detect/src/detect/bit.rs')
-rw-r--r--library/stdarch/crates/std_detect/src/detect/bit.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/bit.rs b/library/stdarch/crates/std_detect/src/detect/bit.rs
new file mode 100644
index 00000000000..578f0b16b74
--- /dev/null
+++ b/library/stdarch/crates/std_detect/src/detect/bit.rs
@@ -0,0 +1,9 @@
+//! Bit manipulation utilities.
+
+/// Tests the `bit` of `x`.
+#[allow(dead_code)]
+#[inline]
+pub(crate) fn test(x: usize, bit: u32) -> bool {
+    debug_assert!(bit < 32, "bit index out-of-bounds");
+    x & (1 << bit) != 0
+}