В примерах имеем такую конструкцию (\Keil\ARM\Boards\Keil\MCB1700\EasyWEB\tcpip.h) // macros #define SWAPB(Word) ((unsigned short)((Word) << 8) | ((Word) >> 8)) // convert little <-> big endian
Какая-то она некузявая. И доставляет много, много радости, ежели Word - short int
В доке есть __swp: This intrinsic inserts a SWP{size} instruction into the instruction stream generated by the compiler. It enables you to swap data between memory locations from your C or C++ code.
Note The use of SWP and SWPB is deprecated in ARMv6 and above.
deprecated - надо понимать так, что устарело....
Так вот - вопрос - как делать это по быстрому и кошерно ?
|