Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions crates/core_arch/src/x86/bt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ macro_rules! bt {
/// Returns the bit in position `b` of the memory addressed by `p`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittest)
///
/// # Safety
///
/// - `p` must be valid for reads of 4 bytes.
/// - `b` must be in the range `0..=31`.
#[inline]
#[cfg_attr(test, assert_instr(bt))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -40,6 +45,11 @@ pub unsafe fn _bittest(p: *const i32, b: i32) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then sets the bit to `1`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandset)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 4 bytes.
/// - `b` must be in the range `0..=31`.
#[inline]
#[cfg_attr(test, assert_instr(bts))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -59,6 +69,11 @@ pub unsafe fn _bittestandset(p: *mut i32, b: i32) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then resets that bit to `0`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandreset)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 4 bytes.
/// - `b` must be in the range `0..=31`.
#[inline]
#[cfg_attr(test, assert_instr(btr))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -78,6 +93,11 @@ pub unsafe fn _bittestandreset(p: *mut i32, b: i32) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then inverts that bit.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandcomplement)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 4 bytes.
/// - `b` must be in the range `0..=31`.
#[inline]
#[cfg_attr(test, assert_instr(btc))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand Down
20 changes: 20 additions & 0 deletions crates/core_arch/src/x86_64/bt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ macro_rules! bt {
/// Returns the bit in position `b` of the memory addressed by `p`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittest64)
///
/// # Safety
///
/// - `p` must be valid for reads of 8 bytes.
/// - `b` must be in the range `0..=63`.
#[inline]
#[cfg_attr(test, assert_instr(bt))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -40,6 +45,11 @@ pub unsafe fn _bittest64(p: *const i64, b: i64) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then sets the bit to `1`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandset64)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 8 bytes.
/// - `b` must be in the range `0..=63`.
#[inline]
#[cfg_attr(test, assert_instr(bts))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -59,6 +69,11 @@ pub unsafe fn _bittestandset64(p: *mut i64, b: i64) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then resets that bit to `0`.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandreset64)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 8 bytes.
/// - `b` must be in the range `0..=63`.
#[inline]
#[cfg_attr(test, assert_instr(btr))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand All @@ -78,6 +93,11 @@ pub unsafe fn _bittestandreset64(p: *mut i64, b: i64) -> u8 {
/// Returns the bit in position `b` of the memory addressed by `p`, then inverts that bit.
///
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bittestandcomplement64)
///
/// # Safety
///
/// - `p` must be valid for reads and writes of 8 bytes.
/// - `b` must be in the range `0..=63`.
#[inline]
#[cfg_attr(test, assert_instr(btc))]
#[stable(feature = "simd_x86_bittest", since = "1.55.0")]
Expand Down
Loading