fn alloc<T>(elems: usize) -> Result<NonNull<T>, AllocationError> {
    let size = size_of::<T>()
        .checked_mul(elems)
        .ok_or(AllocationError::WouldOverflow)?
        .try_into()?;
    if size == 0 {
        Err(AllocationError::ZeroSized)
    } else {
        NonNull::new(unsafe { MKL_malloc(size, MKL_ALIGN) }.cast())
            .ok_or(AllocationError::AllocationFailed)
    }
}
// allocate memory with MKL_ALIGN-byte alignment
allocate memory with MKL_ALIGN-byte alignment
allocate memory with MKL_ALIGN - byte alignment
fn alloc<T>(elems: usize) -> Result<NonNull<T>, AllocationError> {
    let size = size_of::<T>()
        .checked_mul(elems)
        .ok_or(AllocationError::WouldOverflow)?
        .try_into()?;
    if size == 0 {
        Err(AllocationError::ZeroSized)
    } else {
        NonNull::new(unsafe { MKL_malloc(size, MKL_ALIGN) }.cast())
            .ok_or(AllocationError::AllocationFailed)
    }
}
fn alloc < T > ( elems : usize ) -> Result < NonNull < T > , AllocationError > { let size = size_of :: < T > ( ) . checked_mul ( elems ) . ok_or ( AllocationError :: WouldOverflow ) ? . try_into ( ) ? ; if size == 0 { Err ( AllocationError :: ZeroSized ) } else { NonNull :: new ( unsafe { MKL_malloc ( size , MKL_ALIGN ) } . cast ( ) ) . ok_or ( AllocationError :: AllocationFailed ) } }
allocate memory with MKL_ALIGN-byte alignment
allocate memory with MKL_ALIGN - byte alignment
elems
usize
elems
usize