ftol and the 64bit Delphi inline asm changes

Home / ftol and the 64bit Delphi inline asm changes

Above is a Delphi inline asm version of the ftol (Floating Point to Integer Conversion) function used by our HotPDF Delphi PDF component.

When compiling above Delphi codes in the 64-bit target platform, Delphi will raise below error:
[dcc64 Error] E1025 Unsupported language feature: ‘ASM’

The reason is: The 64-bit Delphi compiler DCC64 does not support mixed Pascal/assembly code.
DCC64.EXE supports 64-bit assembly code, but the routines must be written completely in assembler.

In addition, the 64-bit asm codes have many different than the 32-bit ones, you can not copy the 32-bit asm codes to the 64-bit assembler routines directly, you must re-write them from scratch, I found below codes from the internet:

But maybe we do not really need assembly this routine,

The trunc function of Delphi just returns the integer part of a floating point number, that’s the conversion from floating point to integer. The speed of this version should be not bad.

, ,

About Author

about author

losLab

Devoted to developing PDF and Spreadsheet developer library, including PDF creation, PDF manipulation, PDF rendering library, and Excel Spreadsheet creation & manipulation library.