Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ARMÖÐCºÍ»ã±à»ìºÏ±à³Ì¼°Ê¾Àý

1£® ÔÚCÓïÑÔÖÐÄÚǶ»ã±à
ÔÚCÖÐÄÚǶµÄ»ã±àÖ¸Áî°üº¬´ó²¿·ÖµÄARMºÍThumbÖ¸Á²»¹ýÆäʹÓÃÓë»ã±àÎļþÖеÄÖ¸ÁîÓÐЩ²»Í¬£¬´æÔÚһЩÏÞÖÆ£¬Ö÷ÒªÓÐÏÂÃ漸¸ö·½Ã棺
 
a. ²»ÄÜÖ±½ÓÏòPC¼Ä´æÆ÷¸³Öµ£¬³ÌÐòÌøתҪʹÓÃB»òÕßBLÖ¸Áî
b. ÔÚʹÓÃÎïÀí¼Ä´æÆ÷ʱ£¬²»ÒªÊ¹ÓùýÓÚ¸´ÔÓµÄC±í´ïʽ£¬±ÜÃâÎïÀí¼Ä´æÆ÷³åÍ»
c. R12ºÍR13¿ÉÄܱ»±àÒëÆ÷ÓÃÀ´´æ·ÅÖмä±àÒë½á¹û£¬¼ÆËã±í´ïʽֵʱ¿ÉÄܽ«R0µ½R3¡¢R12¼°R14ÓÃÓÚ×Ó³ÌÐòµ÷Óã¬Òò´ËÒª±ÜÃâÖ±½ÓʹÓÃÕâЩÎïÀí¼Ä´æÆ÷
d. Ò»°ã²»ÒªÖ±½ÓÖ¸¶¨ÎïÀí¼Ä´æÆ÷£¬¶øÈñàÒëÆ÷½øÐзÖÅä
ÄÚǶ»ã±àʹÓõıê¼ÇÊÇ __asm»òÕßasm¹Ø¼ü×Ö£¬Ó÷¨ÈçÏ£º
__asm
{
instruction [; instruction]

[instruction]
}
asm(“instruction [; instruction]”);
ÏÂÃæͨ¹ýÒ»¸öÀý×ÓÀ´ËµÃ÷ÈçºÎÔÚCÖÐÄÚǶ»ã±àÓïÑÔ£¬
#include <stdio.h>
 
void my_strcpy(const char *src, char *dest)
{
char ch;
 
__asm
{
loop:
ldrb ch, [src], #1
strb ch, [dest], #1
cmp ch, #0
bne loop
}
}
 
int main()
{
char *a = "forget it and move on!";
char b[64];
 
my_strcpy(a, b);
printf("original: %s", a);
printf("copyed: %s", b);
return 0;
}
ÔÚÕâÀïCºÍ»ã±àÖ®¼äµÄÖµ´«µÝÊÇÓÃCµÄÖ¸ÕëÀ´ÊµÏֵģ¬ÒòΪָÕë¶ÔÓ¦µÄÊǵØÖ·£¬ËùÒÔ»ã±àÖÐÒ²¿ÉÒÔ·ÃÎÊ¡£
 
2£® ÔÚ»ã±àÖÐʹÓÃC¶¨ÒåµÄÈ«¾Ö±äÁ¿
ÄÚǶ»ã±à²»Óõ¥¶À±à¼­»ã±àÓïÑÔÎļþ£¬±È½Ï¼ò½à£¬µ«ÊÇÓÐÖî¶àÏÞÖÆ£¬µ±»ã±àµÄ´úÂë½Ï¶àʱһ°ã·ÅÔÚµ¥¶ÀµÄ»ã±àÎļþÖС£Õâʱ¾ÍÐèÒªÔÚ»ã±àºÍCÖ®¼ä½øÐÐһЩÊý¾ÝµÄ´«µÝ£¬×î¼ò±ãµÄ°ì·¨¾ÍÊÇʹÓÃÈ«¾Ö±äÁ¿¡£
/* cfile.c
* ¶¨ÒåÈ«¾Ö±äÁ¿£¬²¢×÷ΪÖ÷µ÷³ÌÐò
*/
 
#include <stdio.h>
int gVar_1 = 12;
extern asmDouble(void);
 
int main()
{
printf("original value of gVar_1 is: %d", gVar_1);
asmDouble();
printf(" modified value of gVar_1 is: %d", gVar_1);
return 0;
}
 
¶ÔÓ¦µÄ»ã±àÓïÑÔÎļþ
;called by main(in C),to double an integer, a global var defined in C is used.
 
AREA asmfile, CODE, READONLY
 
EXPORT asmDouble
IMPORT gVar_1
 
asmDouble
ldr r0, =gVar_1
ldr r1, [r0]
mov r2, #2
mul r3, r1, r2
str r3, [r0]
mov pc, lr
END
 
3£® ÔÚCÖе÷Óûã±àµÄº¯Êý
ÔÚCÖе÷Óûã±àÎļþÖеĺ¯Êý£¬Òª×öµÄÖ÷Òª¹¤×÷Ó


Ïà¹ØÎĵµ£º

×Ô¼º¶¯ÊÖдһ¸öÅжÏÍøÖ·ºÏ·¨µÄC\C++µÄÕýÔò±í´ïʽ³ÌÐò

#include<stdio.h>
#include<regex.h>
int main(int argc, char** argv)
{
if(IsLegalPage("http://www.baidu.com"))
printf("¸ÃÍøÒ³ºÏ·¨\n");
else printf("¸ÃÍøÒ³²»ºÏ·¨£¡£¡£¡\n");
return 0;
}
/* º¯Êý˵Ã÷£ºÅжÏÍøÒ³ÊÇ·ñºÏ·¨
* ÊäÈë²ÎÊý£ºÐèÒªÅжϵÄÍø ......

C¶ÓÁÐ Êä³öÑî»ÔÈý½Ç


Ò²ÊÇÖÐÈí±ÊÊÔµÄËã·¨Ì⣬µ±Ê±²¢²»ÖªµÀ½ÐÑî»ÔÈý½Ç£¬°¦¡£NÄê²»ÓÃÁË£¬»¹µÃÔÙÊ°Æð£¬ÎªÁËÄǸöÃΡ£
#include <stdio.h>
void main()
{
    int a[50][50];
    int i,j,n;
    printf("Please input Number:");
    scanf("%d",&n);
  ......

LinuxÄÚºËÈëÃÅ£¨Èý£©—— CÓïÑÔ»ù±¾¹¦

    linuxÊÇÒ»¸ö¸´ÔÓµÄÈí¼þϵͳ£¬ÆäÄÚºËÔ´´úÂëÍùÍù»áÓõ½Ò»Ð©ÔÚÓ¦ÓóÌÐòÉè¼ÆÖв¿³£¼ûÓïÑԳɷֺͱà³Ì¼¼ÇÉ£¬ÕâЩ¶¼ÊÇ·ÖÎöÄÚºËÔ´´úÂëµÄ»ù±¾¹¦£¬Ï£Íû´ó¼ÒÄÜÖصãÕÆÎÕ¡£
    Ê×ÏÈ£¬gcc±àÒëÆ÷´ÓÓïÑÔÀïÎüÊÕÁË“inline”ºÍ“const”¡£inlineº¯ÊýµÄ´óÁ¿Ê¹Óã¬ÓÐÀûÓÚÌá¸ßÔËÐ ......

[C/C++ Digestion] – Rule of Three, ¸´ÖÆ¿ØÖÆ


[C/C++ Digestion] – Rule of Three,
¸´ÖÆ¿ØÖÆ
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-04-13
 
[1]
¸´Öƹ¹Ô캯Êý
copy constructor
Rule of Three
ÊÇÖ¸ÀàÈç¹ûÐèÒªÎö¹¹º¯Êý£¬Ôòͨ³£Ò²ÐèÒª¸´Öƹ¹Ô캯ÊýºÍ¸³Öµ²Ù×÷·û¡£¶øÆäʵϰ¹ßµØÏÔʾ±àдÕâÈýÕß±¾¾ÍÊÇÒ»¸öÁ¼ºÃµÄÏ°¹ß¡£Òò ......

CͼÐκ¯Êý½âÎö

CÓïÑÔÖУ¬Í¼Ðκ¯Êý´óÖ¿ɷÖΪÁ½Àࣺ×Ö·ûģʽº¯ÊýºÍͼÐÎģʽº¯Êý¡£±¾½ÚÎÒÃÇÁ·Ï°Ê¹ÓÃ×Ö·ûģʽº¯Êý¡£  
          ʹÓÃ×Ö·ûģʽº¯ÊýÓ¦¸ÃÔÚ³ÌÐòÖÐÁªÈëconio.hÍ·²¿Îļþ¡£  
          ÏÂÃæÊÇһЩº¯ÊýµÄ×÷Óà  
  1)     void   &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ