汇编 OR运算

知识点:

 OR运算
 逻辑或
 按位或


一、OR运算
  12||1=1;   1||01=1;
  0||0=0;
   ||   //逻辑或
   |    //按位或

int _tmain(int argc, _TCHAR* argv[])
{
	int i,j,k;
	/*i=21;
	j=65;*/
	i=0x33; //0110011
	j=0x66; //1100110
	        //1110111
	        //i|j=0x77;
	k=i||j;//逻辑或0,1
	__asm mov eax,eax

	k=i|j; //按位或
//00401006  |.  C745 FC 33000>MOV DWORD PTR SS:[EBP-4],33              ;  i=0x15=0010101
//0040100D  |.  C745 F4 66000>MOV DWORD PTR SS:[EBP-C],66              ;  j=0x41=1000001
//00401014  |.  837D FC 00    CMP DWORD PTR SS:[EBP-4],0               ;  i Or j=1010101
//00401018  |.  75 0F         JNZ SHORT asm_OR.00401029
//0040101A  |.  837D F4 00    CMP DWORD PTR SS:[EBP-C],0
//0040101E  |.  75 09         JNZ SHORT asm_OR.00401029
//00401020  |.  C745 F0 00000>MOV DWORD PTR SS:[EBP-10],0              ;  t=0;
//00401027  |.  EB 07         JMP SHORT asm_OR.00401030
//00401029  |>  C745 F0 01000>MOV DWORD PTR SS:[EBP-10],1              ;  t=1;
//00401030  |>  8B45 F0       MOV EAX,DWORD PTR SS:[EBP-10]
//00401033  |.  8945 F8       MOV DWORD PTR SS:[EBP-8],EAX             ;  k=t=i||j;
//00401036  |.  8BC0          MOV EAX,EAX                              ;  __asm mov eax,eax
//00401038  |.  8B4D FC       MOV ECX,DWORD PTR SS:[EBP-4]
//0040103B  |.  0B4D F4       OR ECX,DWORD PTR SS:[EBP-C]              ;  ecx=i OR j
//0040103E  |.  894D F8       MOV DWORD PTR SS:[EBP-8],ECX             ;  k=ecx




	return 0;
}

 

posted @ 2017-02-06 17:55  whzym111  阅读(770)  评论(0编辑  收藏  举报