An example of Delphi's embedded ASM: BYTE Quick Convert to 16 Billing Strings

zhaozj2021-02-11  165

The last Delphi made ASM embedded process / function format is: procedure procname (...); asm ... End; for this process / function, the entire entire is written by ASM. The embedded ASM has a common usage, that is, in the program part calls ASM: Function ByTohex (src: byte): String; Begin SetLength (Result, 2); ASM MOV EDI, [Result] MOV EDI, [EDI] MOV Al, SRC MOV AH, Al // Save to Ah SHR Al, 4 // Output High 4 Bits Add Al, '0' CMP AL, '9' JBE @@ Outcharlo Add Al, 'A' - '9'-1 @@ Outcharlo: and ah, $ f add Ah, '0' CMP AH, '9' JBE @@ Outchar Add Ah, 'A' - '9'-1 @@ Outchar: Stosw End; End; the subroutine can be implemented One byte of SRC is converted to a 16-way form. Just a friend has such a problem, is it fast enough? :) Of course, the fastest way is not this, want faster? Lala roller, look at:

Use the check form! 512 bytes of table, the fastest speed! :)

转载请注明原文地址:https://www.9cbs.com/read-5645.html

New Post(0)