richliu’s blog

Linux, 工作, 生活.

richliu’s blog header image 2

ARMv6 的 Word Swap 指令

May 23rd, 2009 · No Comments

ARMv6 加入了幾個好用的 Swap 指令. 不需要用軟體算來算去
請參考 http://www.arm.com/pdfs/ARMv6_Architecture.pdf

REV
REV16
REVSH

ARM_REV

最常用的應該是 REV 吧.

Realview inline assembly 很簡單.

unsigned int tmp = 0×12345678;
__asm{
REV tmp, tmp
}

GNU C++ inline assembly 為(未測)

unsigned int tmp = 0×12345678;
__asm__ __volatile__ (
“REV %0,%0;” : “=r”(tmp) : “r”(tmp):”r5″);
);

On this day..

Tags: ,

Related posts

Tags: Embedded · Linux · Programming

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment