mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
Add pointer masking convenience functions
This commit adds the following functions all of which have a signature `pointer, usize -> pointer`: - `<*mut T>::mask` - `<*const T>::mask` - `intrinsics::ptr_mask` These functions are equivalent to `.map_addr(|a| a & mask)` but they utilize `llvm.ptrmask` llvm intrinsic. *masks your pointers*
This commit is contained in:
parent
ee65a1018f
commit
5b32aa0747
@ -540,6 +540,13 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
ret.write_cvalue(fx, CValue::by_val(res, base.layout()));
|
||||
}
|
||||
|
||||
sym::ptr_mask => {
|
||||
intrinsic_args!(fx, args => (ptr, mask); intrinsic);
|
||||
let ptr_val = ptr.load_scalar(fx);
|
||||
|
||||
fx.bcx.ins().band(ptr_val, mask);
|
||||
}
|
||||
|
||||
sym::transmute => {
|
||||
intrinsic_args!(fx, args => (from); intrinsic);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user