rename ptr::from_exposed_addr -> ptr::with_exposed_provenance

This commit is contained in:
Ralf Jung 2024-03-23 11:47:11 +01:00 committed by Caleb Zulawski
parent 7ba49ef81c
commit 2b03143cfe
3 changed files with 14 additions and 14 deletions

View file

@ -64,13 +64,13 @@ pub trait SimdConstPtr: Copy + Sealed {
fn with_addr(self, addr: Self::Usize) -> Self;
/// Gets the "address" portion of the pointer, and "exposes" the provenance part for future use
/// in [`Self::from_exposed_addr`].
/// in [`Self::with_exposed_provenance`].
fn expose_addr(self) -> Self::Usize;
/// Convert an address back to a pointer, picking up a previously "exposed" provenance.
///
/// Equivalent to calling [`core::ptr::from_exposed_addr`] on each element.
fn from_exposed_addr(addr: Self::Usize) -> Self;
/// Equivalent to calling [`core::ptr::with_exposed_provenance`] on each element.
fn with_exposed_provenance(addr: Self::Usize) -> Self;
/// Calculates the offset from a pointer using wrapping arithmetic.
///
@ -158,7 +158,7 @@ where
}
#[inline]
fn from_exposed_addr(addr: Self::Usize) -> Self {
fn with_exposed_provenance(addr: Self::Usize) -> Self {
// Safety: `self` is a pointer vector
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
}

View file

@ -61,13 +61,13 @@ pub trait SimdMutPtr: Copy + Sealed {
fn with_addr(self, addr: Self::Usize) -> Self;
/// Gets the "address" portion of the pointer, and "exposes" the provenance part for future use
/// in [`Self::from_exposed_addr`].
/// in [`Self::with_exposed_provenance`].
fn expose_addr(self) -> Self::Usize;
/// Convert an address back to a pointer, picking up a previously "exposed" provenance.
///
/// Equivalent to calling [`core::ptr::from_exposed_addr_mut`] on each element.
fn from_exposed_addr(addr: Self::Usize) -> Self;
/// Equivalent to calling [`core::ptr::with_exposed_provenance_mut`] on each element.
fn with_exposed_provenance(addr: Self::Usize) -> Self;
/// Calculates the offset from a pointer using wrapping arithmetic.
///
@ -155,7 +155,7 @@ where
}
#[inline]
fn from_exposed_addr(addr: Self::Usize) -> Self {
fn with_exposed_provenance(addr: Self::Usize) -> Self {
// Safety: `self` is a pointer vector
unsafe { core::intrinsics::simd::simd_from_exposed_addr(addr) }
}

View file

@ -80,10 +80,10 @@ mod const_ptr {
);
}
fn from_exposed_addr<const LANES: usize>() {
fn with_exposed_provenance<const LANES: usize>() {
test_helpers::test_unary_elementwise(
&Simd::<*const u32, LANES>::from_exposed_addr,
&core::ptr::from_exposed_addr::<u32>,
&Simd::<*const u32, LANES>::with_exposed_provenance,
&core::ptr::with_exposed_provenance::<u32>,
&|_| true,
);
}
@ -103,10 +103,10 @@ mod mut_ptr {
);
}
fn from_exposed_addr<const LANES: usize>() {
fn with_exposed_provenance<const LANES: usize>() {
test_helpers::test_unary_elementwise(
&Simd::<*mut u32, LANES>::from_exposed_addr,
&core::ptr::from_exposed_addr_mut::<u32>,
&Simd::<*mut u32, LANES>::with_exposed_provenance,
&core::ptr::with_exposed_provenance_mut::<u32>,
&|_| true,
);
}