Attempt to use `intrinsics!`

This commit is contained in:
Lokathor 2019-01-04 19:17:02 -07:00
parent 2e8b85439f
commit 9a68e74ebd
1 changed files with 51 additions and 48 deletions

View File

@ -301,14 +301,16 @@ macro_rules! impl_wide_int {
impl_wide_int!(u32, u64, 32);
impl_wide_int!(u64, u128, 64);
#[no_mangle]
intrinsics! {
#[cfg(any(
target_pointer_width = "16",
target_pointer_width = "32",
target_pointer_width = "64"
))]
pub extern "C" fn __clzsi2(mut x: usize) -> usize {
pub extern "C" fn __clzsi2(x: usize) -> usize {
// TODO: const this? Would require const-if
// Note(Lokathor): the `intrinsics!` macro can't process mut inputs
let mut x = x;
let mut y: usize;
let mut n: usize = {
#[cfg(target_pointer_width = "64")]
@ -362,3 +364,4 @@ pub extern "C" fn __clzsi2(mut x: usize) -> usize {
n - x
}
}
}