Int2x32ToInt64 function
Numerical conversion routines |
![]() ![]() ![]() |
acUtils
|
function Int2x32ToInt64(IntHi, IntLo: DWord): LongLong;
|
The Int2x32ToInt64 function function multiplies two signed 32-bit integers, returning a signed 64-bit integer result.
|
function Int2x32ToInt64(const IntHi, IntLo: DWord): LongLong;
|
|
{$IFNDEF D4}
|
function UIntToInt(const Int: DWord): LongLong;
|
type
|
TDoubleWord = packed record
|
case Integer of
|
0: (LoWord, HiWord: Word);
|
1: (DWord: DWord);
|
end;
|
var
|
DW: TDoubleWord;
|
begin
|
Result := Int;
|
if Int < 0 then
|
with DW do
|
begin
|
DWord := Int;
|
Result := HiWord;
|
Result := Result * $10000 + LoWord; // shl 16 + LoWord
|
end;
|
end;
|
{$ENDIF}
|
|
begin
|
{$IFDEF D4}
|
Result := IntHi;
|
Result := Result shl 32 + IntLo;
|
{$ELSE}
|
// IntHi shl 32 + IntLo
|
Result := UIntToInt(IntHi) * $10000 * $10000 + UIntToInt(IntLo);
|
{$ENDIF}
|
end;
|