unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
n, i, j, b: integer;
begin
b := GetTickCount;
n := 100;
for i := 1 to 100000000do
begin
j := n mod 8;
j := n div 8;
end;
if j > -1 then
showmessage(inttostr(GetTickCount - b));
b := GetTickCount;
for i := 1 to 100000000do
begin
j := n shl 29 shr 29;
j := n shr 3;
end;
if j > -1 then
showmessage(inttostr(GetTickCount - b));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
n, i, j, b: integer;
begin
n := 242342;
memo1.Lines.Add(inttostr(n mod 8));
memo1.Lines.Add(inttostr(n div 8));
memo1.Lines.Add(inttostr(n shl 29 shr 29));
memo1.Lines.Add(inttostr(n shr 3));
end;
end.
object Form1: TForm1
Left = 192
Top = 107
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 160
Top = 184
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 160
Top = 312
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 1
OnClick = Button2Click
end
object Memo1: TMemo
Left = 344
Top = 120
Width = 185
Height = 257
Lines.Strings = (
'Memo1')
TabOrder = 2
end
end