Forum > General

[SOLVED] 64-bit FPC generate 386 code (LZMA decoder error)

(1/2) > >>

having strange problem with the pascal LZMA port,
The decoder works only when compiled with 32 bit compiler.
Not when compiled with 64bit compiler.
The encoder works with both compilers ok and produces the same packed files.

Is there any option to say the compiler to generate 386 code for some units?
SOmething like the $G option in TP?
The decoder is full of shl, shr and or operations because it plays with stream bits.
I think somewhere there is the problem.
Already tried to replace all Integers with Longints but didn't help.

Thanks tk

It's probably either a bug or a mode problem. Do you compile with -Sd or {$mode delphi}?

Lots of old Delphi code is full of bugs that potentially that hamper 64-bit usage.

The only solution is to stay on 32-bit or fix the bug.   Typical issues are 32-bit assembler (sometimes accepted in 64-bit), integer to pointer conversions

Yes this must be a bug in 64bit FPC, added a bug report

Longint arithmetic is expanded to the native integer type, or in some cases 64-bit.

So the correct way to do it in your case would be like this:
t := ((Code - Range) shr 31) and 1;


--- Quote from: tk on July 12, 2014, 01:39:20 pm ---Yes this must be a bug in 64bit FPC, added a bug report

--- End quote ---

I meant a bug in the LZMA code, unless it works with 64-bit Delphi.


[0] Message Index

[#] Next page

Go to full version