In 64-bit platforms an arifmetic operations with pointer must be doing with conversion it's to PtrUInt type. So maybe need to complitly rewrite this code.
Besides, rowOffset is 32-bit integer and PtrUInt is 64-bit on x64 - not very correct assignment operation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The main problem comes from the operation, by example the following line
temp := Byte(1) - Byte(1);
will raise an exception when range check is enabled even if temp is an integer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok my previous assertion was wrong
delta := Int64(Byte(250) - Byte(254));
do not raise any exception the result is valid.
BUT
delta:= int64(PtrUInt(newbase) - PtrUInt(oldbase));
is raising an out of range exception
(tested with
newbase := Pointer(2140012872);
oldbase := Pointer(2144797000);
)
the same thing with
delta:= int64(PtrUInt(newbase)) - int64(PtrUInt(oldbase));
do not raise any exception the result is valid.
To my mind it's delphi int64 error, but I can be fixed by casting both arguments
delta:= int64(PtrUInt(newbase)) - int64(PtrUInt(oldbase));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In 64-bit platforms an arifmetic operations with pointer must be doing with conversion it's to PtrUInt type. So maybe need to complitly rewrite this code.
Besides, rowOffset is 32-bit integer and PtrUInt is 64-bit on x64 - not very correct assignment operation.
The main problem comes from the operation, by example the following line
temp := Byte(1) - Byte(1);
will raise an exception when range check is enabled even if temp is an integer
Ok my previous assertion was wrong
delta := Int64(Byte(250) - Byte(254));
do not raise any exception the result is valid.
BUT
delta:= int64(PtrUInt(newbase) - PtrUInt(oldbase));
is raising an out of range exception
(tested with
newbase := Pointer(2140012872);
oldbase := Pointer(2144797000);
)
the same thing with
delta:= int64(PtrUInt(newbase)) - int64(PtrUInt(oldbase));
do not raise any exception the result is valid.
To my mind it's delphi int64 error, but I can be fixed by casting both arguments
delta:= int64(PtrUInt(newbase)) - int64(PtrUInt(oldbase));
ok, go fix :)