1
Fork 0
rust/compiler/rustc_codegen_gcc/src/intrinsic
bors 1e978a3627 Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
Add pointer masking convenience functions

This PR adds the following public API:
```rust
impl<T: ?Sized> *const T {
    fn mask(self, mask: usize) -> *const T;
}

impl<T: ?Sized> *mut T {
    fn mask(self, mask: usize) -> *const T;
}

// mod intrinsics
fn mask<T>(ptr: *const T, mask: usize) -> *const T
```
This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic.

Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352

cc `@Gankra` `@scottmcm` `@RalfJung`

r? rust-lang/libs-api
2022-08-28 01:34:47 +00:00
..
archs.rs Merge commit 'e8dca3e87d' into sync_from_cg_gcc 2022-06-06 22:04:37 -04:00
llvm.rs Merge commit 'e8dca3e87d' into sync_from_cg_gcc 2022-06-06 22:04:37 -04:00
mod.rs Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm 2022-08-28 01:34:47 +00:00
simd.rs Remove unused macro rule 2022-06-07 08:50:13 -04:00