本帖最后由 sept80 于 2013-10-8 16:07 编辑
数组定义
UNS_8 s[32] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32};
UNS_8 d[32] = {0};
数组复制程序
void copyArray(UNS_8* pA,UNS_8 * pB, UNS_32 num)
{
while(num > 0)
{
*pB = *pA;
pB++;
pA++;
num--;
}
}
调用
copyArray(s,d,32);
反汇编代码
650: void copyArray(UNS_8* pA,UNS_8 * pB, UNS_32 num)
651: {
0x80004B74 E12FFF1E BX R14
652: while(num > 0)
653: {
0x80004B78 EA000004 B 0x80004B90
654: *pB = *pA;
0x80004B7C E5D03000 LDRB R3,[R0]
0x80004B80 E5C13000 STRB R3,[R1]
655: pB++;
0x80004B84 E2811001 ADD R1,R1,#0x00000001
656: pA++;
0x80004B88 E2800001 ADD R0,R0,#0x00000001
657: num--;
658: }
0x80004B8C E2422001 SUB R2,R2,#0x00000001
0x80004B90 E3520000 CMP R2,#output(0x00000000)
0x80004B94 1AFFFFF8 BNE 0x80004B7C
659: }
结果
d[32] = {0x01,0x02,0x02,0x04,0x03,0x06,0x04,0x08,0x05,0x0A,0x06,0x0C,0x07,0x0E,0x08,0x10,0x09,0x12,0x0A,0x14,0x0B,0x16,0x0C,0x18,0x0D,0x1A,0x0E,0x1C,0x0F,0x1E,0x10,0x20};
|