• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


30 Nov, 2024

Updated at 05 Dec, 2024

Replacing Macros

In C langue:
#define Temp el2
asm("msr x, " #Temp)

=> asm("msr x, el2")

In Rust langue:
const Temp: &str = "el2";
asm!(concat!("msr x, " , stringfy!(Temp)))

=> asm!("msr x, Temp")

The results are different

I think by changing “const Temp: &str = "el2";” or stringfy!(Temp), the result is the same as C.

3 posts - 2 participants

Read full topic