[−][src]Macro r3_portkit::pp_asm
Preprocessed asm!
.
Examples
#![feature(asm)] #![feature(decl_macro)] #[macro_export] // work-around for mysterious macro hygienics behavior macro_rules! the_ultimate_answer { () => { "42" }; } // miri doesn't support inline assembly #[cfg(not(miri))] unsafe { let output: usize; r3_portkit::pptext::pp_asm!( // The input fragments are simply concatenated. This means `mov` // would be part of this line comment if it didn't include a line // break. "# hoge \n" if cfg!(target_arch = "x86_64") { "mov {}, " crate::the_ultimate_answer!() } if cfg!(any(target_arch = "aarch64", target_arch = "arm")) { "mov {}, #" crate::the_ultimate_answer!() } if cfg!(any(target_arch = "riscv32", target_arch = "riscv64")) { "li {}, " crate::the_ultimate_answer!() }, out(reg) output ); assert_eq!(output.to_string(), crate::the_ultimate_answer!()); }