1 | /// An internal macro to invoke an assembly routine. |
2 | /// |
3 | /// Depending on whether the unstable `inline-asm` feature is enabled, this will either call into |
4 | /// the inline assembly implementation directly, or through the FFI shim (see `asm/lib.rs`). |
5 | macro_rules! call_asm { |
6 | ( $func:ident ( $($args:ident: $tys:ty),* ) $(-> $ret:ty)? ) => {{ |
7 | #[allow(unused_unsafe)] |
8 | unsafe { |
9 | match () { |
10 | #[cfg(feature = "inline-asm" )] |
11 | () => crate::asm::inline::$func($($args),*), |
12 | |
13 | #[cfg(not(feature = "inline-asm" ))] |
14 | () => { |
15 | extern "C" { |
16 | fn $func($($args: $tys),*) $(-> $ret)?; |
17 | } |
18 | |
19 | $func($($args),*) |
20 | }, |
21 | } |
22 | } |
23 | }}; |
24 | } |
25 | |