cancel
Showing results for 
Search instead for 
Did you mean: 

INC /DEC

matthiasjunge9
Associate II
Posted on July 29, 2008 at 11:24

INC /DEC

2 REPLIES 2
matthiasjunge9
Associate II
Posted on May 17, 2011 at 12:40

an expression like

unsigned int i;

i--;

is compiled as

LDR

SUBS

STR

is there any sort of INC / DEC command to do this in one instruction on the ARM like on other processors?

matt

disirio
Associate II
Posted on May 17, 2011 at 12:40

SUBS is equivalent to a decrement instruction. LDR and STR are only required if your variable resides in memory and it is not allocated into a register.

So: yes, it has increment/decrement instructions but it is not capable to increment/decrement variables in memory (like most other RISCs, it is a load/store machine).

regards,

Giovanni

---

ChibiOS/RT

http://chibios.sourceforge.net