program writer's quality decision.The inline assembly is passed in C + +The results of the actual discovery of 500W data are as follows:Algorithm name inline assembly algorithm time C + + algorithm timeBubble sort 5W Data slow dying 5W data slow to deathQuick sort 600ms about 500ms around------------------Why there is a fast sorting algorithm, the results of the assembly is not a C + + efficiency is high, because I write the inline assembly is not automatically generated by the compiler high ef
the quality of the high and low decision.
Inline assembly is passed in C + +
actually found the 500W data sorting results are as follows:
Algorithm name inline assembler algorithm time C + + algorithm time
Bubble sort 5W data slow to die 5W data slowly dying.
Quick sort 600ms about 500ms around
------------------Why there is a fast sorting algorithm, the compiled results are not as high as C/s + + efficiency, because I write inline assembly without compiler automatic generation of high efficien
With the front: + + (-) There are too many confusing places, (i++) + (i++) and (++i) + (++i) What is the difference? If you understand it from the machine's point of view, it will be enlightened.
Let's take a look at the procedure:
int main() { int i=3; int j=(i++)+(i++); // int j=(++i)+(++i); printf("%d,%d\n",i,j); }
(1) Under VC 6.0:
for (i++) + (i++):
Result: i=5,j=6
The corresponding assembly code is (with detailed comments):
8B 45 FC mov eax,dw
body | ---------> @ 2|------> | -------------------- +|| Decryptor || ---------> @ 3+ -------------------- +@ 1 is a call constructed by computation, because the call location must be determined by @ 2.@ 2 is an encrypted virus.@ 3 is an encryptor used to decrypt @ 2, which is transformed by code obfuscation.In this way, every time other files are infected, the re-generated code will no longer have a fixed feature, which will invalidate the feature scanning mechanism.
2.1 random number design:T
layout is skipped.
Next let's take a look at the virtual function calling Pt-> Foo (); Through the pointer. The resulting assembly code is as follows:01 004230f6 mov eax, dword ptr [EBP + fffff900h]02 004230fc mov edX, dword ptr [eax]03 004230fe mov ESI, ESP04 00423100 mov ECx, dword ptr [EBP + fffff900h]05 00423106 call dword ptr [edX]In row 1st, the address directed by PT is moved into the eax register,
the siteCall makefs4gbsegment; the returned FS segment can be 4 GB memory. EBX =.############# Map the code to a linear address of 80000000 H + CS * 4, avoid NTS not mapped to memory reserved by our code ############MoV eax, FS: [EBX + 800 H]; eax = Linear address up to 10 bits 400 h * 4 = 800 H, determine the location of the page Directory table pointed to in S3.And eax, 0fffff000h; remove the obtained Level 2 page table attribute bit. eax = 80000000h linear address Level 2 page table physical
(Bbs.qianxiao.com)
First, "Claw-free theory": Zhu Min has some opinions on MBA business schools. He believes that entrepreneurs are like a fast-trained Tiger. "When Tigers have claws, they will be worn out and become cats when they enter the MBA program ." He believes that there are two types of creativity: analytical, artificial manufacturing by training MBA, a
check whether your input is correct". I think those characters may be nearby, so double-click "registration failed, check whether your input is correct.
00415829 |> 66: C745 A4 D4> mov word ptr ss: [EBP-5C], 0D40036682f |. BA ADEC4900 mov edx, TextDraw.0049ECAD; Registration failed. Please check whether your input is correct00415834 |. 8D45 B8 lea eax, dword ptr ss: [EBP-48]
In section 00415829, the "jump from 0000004ed" is displayed in the informat
efficiency, should be converted to assembly, the intermediate results into a separate register40.//Thanks to Menzi11 's article, let me realize that the relevant data in the program will make the CPU can not disorderly execution.41.//Here is replaced by pseudo assemblerTYPE S4 = 0;43.Register TYPE r1 = 0;Register TYPE r2 = 0;for (int i = 0; i R1 + + + a[i++];R2 + = a[i++];49.}50.Wuyi Cout52.}
Several of the above versions are reasonable, but these optimizations are based on the assumption that
The test software is Splish.exe.Bytes ------------------------------------------------------------------------------------------I am sure everyone knows the beginning of searching for an algorithm. I will not talk about it here. Next I will directly discuss the assembly code and comments of the algorithm.Bytes ------------------------------------------------------------------------------------------------004015E4 55 push ebp; algorithm started004015E5 8BEC mov ebp, ESP004015E7 6A 20 PUSH 2000401
dummy1, int dummy2){_ ASM {Push EBPMoV EBP, ESPMoV eax, 152Lea edX, 8 [EBP]Int 0x2ePop EBPRET 9}}
It turns out that the user space also has an ntreadfile (), which is executing the self-trapping command "int 0x2e ". Let's take a look at this Assembly Code. Here, 152 is the call number of the System Call ntreadfile (), so when the CPU falls into the system space, the register eax holds the specific system call number. The register
connect them during compilation?In this case, we can conclude that there is another secret. For more information, see ntreadfile () in msvc6/iface/native/syscall/debug/ZW. C:
_ Declspec (naked) _ stdcallNtreadfile (INT dummy0, int dummy1, int dummy2){_ ASM {Push EBPMoV EBP, ESPMoV eax, 152Lea edX, 8 [EBP]Int 0x2ePop EBPRET 9}}
It turns out that the user space also has an ntreadfile (), which is executing the self-trapping command "int 0x2e ". Let's t
In many network development scenarios, memory conversion is often encountered in the following scenarios:
#define PACKAGE_PARSE_ERROR -1#define PACKAGE_PARSE_OK 0int parse_package( int* a, int* b, int* c, int* d, char* buf, int buf_len ){ if( !buf || buf_len
This is a call in the Process of network unpacking, and the packet process is a reverse process.
An application like this can be replaced by an integer forced conversion, and the efficiency will be at least doubled.
To illustrate t
Reading Tips:
《Delphi Image ProcessingThe series focuses on efficiency. The general code is Pascal, and the core code is BaSm.
《C ++ Image ProcessingThe series focuses on code clarity and readability, and all uses C ++ code.
Make sure that the two items are consistent and can be compared with each other.
The code in this article must include the imagedata. Pas unit in "Delphi Image Processing-data type and public process.
The minimum value processing of an image is centered on the current pixel
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.