This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using REV16 in C Code

Hi guys,

First of all, I'm using a LM3S6950 Arm Cortex M3 microcontroller with Keil MDK 3.70. I'm programming in C, Thumb Mode.

For converting low endianess to big endianess I want to use the rev and rev16 instruction.

32 Bit swaps can be done with the build in __rev() inline C function (http://www.keil.com/support/man/docs/armccref/armccref_cjaeegce.htm)

How can I do this with the 16 bit instruction since inline assembler isn't supported in thumb mode?

Thanks for your replies
br Robert

Parents
  • The great thing about using standard C and let the optimizer in the compiler try to figure out suitable assembler instructions is that you get portable code.

    Inline assembly is never portable, and will also sometimes break the normal code generation because the compiler doesn't know what to expect from the inline assembly block(s).

Reply
  • The great thing about using standard C and let the optimizer in the compiler try to figure out suitable assembler instructions is that you get portable code.

    Inline assembly is never portable, and will also sometimes break the normal code generation because the compiler doesn't know what to expect from the inline assembly block(s).

Children