How can I do that with Delphi 6? UInt64 is not known in Delphi 6. It was introduced in later versions.
var
i, j: Int64;
if UInt64(i) < UInt64(j) then ...
I am thinking of an asm procedure.
function UInt64CompareLT(i, j: Int64): Boolean;
asm
???
end;
function UInt64CompareGT(i, j: Int64): Boolean;
asm
???
end;
The
Int64Rec
type fromSysUtils
is designed for the task of picking out the parts of a 64 bit integer.If you happen to be using a Delphi that pre-dates this type, define it yourself:
What's more, you only need a single function that returns -1 for less than, 1 for greater than and 0 for equals. Something like this:
The idea is that you first compare the high order part, and only if that is equal do you then go on to compare the low order part.
This can be made simpler with a compare function for
Cardinal
.Finally, should you need the boolean functions of your question, they can be implemented on top of this more general function.