I am having trouble understanding the goal of the second add.w instruction in the snippet below:
...add.w r1, r4, r5add.w r1, r1, r1, lsr #0x1fasr r1, r1, #1...
I imagine it may have to do with a potential overflow on the first addition. The asr indicates a signed division.So, assuming the following signed variables, it would be:
signed int r1r1 = r4 + r5r1 = r1 + (r1<0 ? 1: 0)r1 = r1 / 2
I do not understand the reason for that check. As anyone seen this kind of idiom before? What could it be used for?
Looks like a rounding. Could it be that r4/r5 are fix-point values?
Hi jw1555, 42Bastian Schick has replied to your question. Does this help answer it? Please mark the answer as accepted or ask for more information. Many thanks.
Is a stack, it's a section of memory that is used during execution, it generally has a static size per program and frequently used to store function parameters. You push the parameters onto the stack when you call a function and the function either address the stack directly or pops off the variables from the stack.
This is called machine language. To make sure we don’t need to read and write programs using bits, every instruction will also have a ”natural language” equivalent, called the assembly language notation !
many are questioning the need for courses on assembly language. ... For example, this is a snippet of an ARM.
View all questions in Classic processors forum