Answer the question
In order to leave comments, you need to log in
How is work with short in asm?
I have work with variable char
Here is a piece of code
short right = acum & 65535;
short left = acum" 16;
and I see this in the asm code
00000230: andi r16,r16,65535
//here the sign bit is inverted as I understand it
00000234: xori r16,r16,32768
00000238: addi r16,r16,-32768
Please tell me the meaning of such conversions? Why is the last addition operation necessary?
Answer the question
In order to leave comments, you need to log in
00000234: xori r16,r16,32768 00000238: addi r16,r16,-32768
Could you please tell me the meaning of such transformations?
short right = acum & 65535;
. It is necessary in order to work with values loaded into registers without thinking about the initial width of their data type. Those. (short)-1
in a 64-bit register will be represented as 0xffffffffffffffff, not 0xffff.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question