unsafe extern "C" {
    fn algorithms_c_is_loaded() -> i32;
}

#[inline]
pub fn ffi_is_loaded() -> bool {
    unsafe { algorithms_c_is_loaded() == 1 }
}

#[inline]
pub(crate) fn ref_to_ptr<T: ?Sized, P>(r: &T) -> *const P {
    r as *const T as *const P
}

#[inline]
pub(crate) fn ref_to_ptr_mut<T: ?Sized, P>(r: &mut T) -> *mut P {
    r as *mut T as *mut P
}

#[cfg(test)]
mod test {
    use crate::ffi_is_loaded;

    #[test]
    fn test_ffi_loaded() {
        assert!(ffi_is_loaded())
    }
}
