[fpc-devel] 64 bit integer result in Win32 problem
jonas.maebe at elis.ugent.be
Mon Aug 20 10:20:04 CEST 2012
ABorka wrote on Mon, 20 Aug 2012:
> Win32 .exe compiled on Win64 computer, latest SVN build.
> I am trying to multiply 2 Integers (Declared as LongInt but
> sometimes need to use it as LongWord) and put the result into a
> QWord (64bit unsigned) result variable on Win32.
> However, it seems that the result is always cut to 32bit.
In Pascal, the type of the result of an expression only depends on its
arguments, never on what you do with it afterwards. Additionally,
integer expressions are evaluated using the "native bit width" if all
factors are <= 32 bit, which is 32 bit on 32 bit systems (exception:
operations involving both longint and cardinal).
If you want a 64 bit result, typecast one of the factors of the
expressions to 64 bit.
More information about the fpc-devel