Forum > General

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

<< < (2/2)


--- Quote from: Laksen on July 12, 2014, 02:33:27 pm ---Longint arithmetic is expanded to the native integer type, or in some cases 64-bit.

--- End quote ---

Unless you retype it to the same type you are working with (here LongInt)...

32 bit Delphi behaves the same as 32 bit FPC, tried for ShortInt, SmallInt now.
In 32 bit Delphi SHR produces negative value from negative value for ShortInt, SmallInt but positive value for Longint.
So generally it is not FPC bug.

Don't have the 64bit Delphi compiler now and won't reopen the issue although I am not very satisfied with this way of compilation.
When working with some bit width I would expect all the operations would take place in that bit width (from my point of view, of course compiler can internally use the most effective way).
SHR is declared as bitwise operator so I would always expect for a negative number to get positive number when SHRed.
As is the case when you SHR this in 32 bit width with 32 bit compiler.
And as is the case when you retype the result as described in my second comment to the bug report.

But why to explicitly retype when the operation result should be already of that type?
I don't know.

Either way, the LZMA decoder works for me now on 64bit compiler, the retyping solved this (your solution would probably either, didn't try).
Hope this thread will help to somebody else trying to use it.


[0] Message Index

[*] Previous page

Go to full version