📄 mmint64.pas
字号:
{========================================================================}
{= (c) 1995-98 SwiftSoft Ronald Dittrich =}
{========================================================================}
{= All Rights Reserved =}
{========================================================================}
{= D 01099 Dresden = Fax.: +49(0)351-8037944 =}
{= Loewenstr.7a = info@swiftsoft.de =}
{========================================================================}
{= Actual versions on http://www.swiftsoft.de/index.html =}
{========================================================================}
{= This code is for reference purposes only and may not be copied or =}
{= distributed in any format electronic or otherwise except one copy =}
{= for backup purposes. =}
{= =}
{= No Delphi Component Kit or Component individually or in a collection=}
{= subclassed or otherwise from the code in this unit, or associated =}
{= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
{= without express permission from SwiftSoft. =}
{= =}
{= For more licence informations please refer to the associated =}
{= HelpFile. =}
{========================================================================}
{= $Date: 17.09.98 - 15:55:48 $ =}
{========================================================================}
unit MMInt64;
{$I COMPILER.INC}
interface
{$IFNDEF DELPHI4}
uses MMUtils;
{$ENDIF}
function int64x64(Param1,Param2: int64): int64;
function int64Div32(Dividend: int64; Divisor: Cardinal): Cardinal;
function int64Mod32(Dividend: int64; Divisor: Cardinal): Cardinal;
implementation
{$IFDEF WIN32}
{$IFNDEF DELPHI4}
{ 64-bit Integer helper routines - recycling C++ RTL routines }
{$L MMINT6432.OBJ}
procedure __llmul; external;
procedure __lldiv; external;
procedure __llmod; external;
procedure __llmulo; external;
procedure __lldivo; external;
procedure __llmodo; external;
procedure __llshl; external;
procedure __llushr; external;
procedure __llumod; external;
procedure __lludiv; external;
{$ENDIF}
{$ENDIF}
{==============================================================================}
function int64x64(Param1,Param2: int64): int64;
{$IFDEF WIN32}
{$IFNDEF DELPHI4}
asm
push ebp
push edx
push eax
mov eax, dword ptr Param1[0]
mov edx, dword ptr Param2[4]
call __llmul
pop ebp
{$ELSE}
begin
Result := Param1*Param2;
{$ENDIF}
{$ELSE}
begin
Result := Param1*Param2;
{$ENDIF}
end;
{==============================================================================}
function int64Div32(Dividend: int64; Divisor: Cardinal): Cardinal;
{$IFDEF WIN32}
{$IFNDEF DELPHI4}
asm
push ebp
xor edx, edx
push edx
push eax
mov eax, dword ptr Dividend[0]
mov edx, dword ptr Dividend[4]
call __lldiv
pop ebp
{$ELSE}
begin
Result := Dividend div Divisor;
{$ENDIF}
{$ELSE}
begin
Result := 0;
{$ENDIF}
end;
{==============================================================================}
function int64Mod32(Dividend: int64; Divisor: Cardinal): Cardinal;
{$IFDEF WIN32}
{$IFNDEF DELPHI4}
asm
push ebp
xor edx, edx
push edx
push eax
mov eax, dword ptr Dividend[0]
mov edx, dword ptr Dividend[4]
call __llmod
pop ebp
{$ELSE}
begin
Result := Dividend mod Divisor;
{$ENDIF}
{$ELSE}
begin
Result := 0;
{$ENDIF}
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -