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

Posted by John Dev


30 Nov, 2024

Updated at 13 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.

1 post - 1 participant

Read full topic