2009年5月29日

Delphi Bits 位元操作

在 Form 上放一個 TMemo
在 FormCreate 事件中加入

procedure TForm1.FormCreate(Sender: TObject);
var
bit: TBits;
begin
with Memo1.Lines do
begin
Clear;
bit := TBits.Create;
try
bit.Size := 0;
bit.Bits[0] := True;
bit.Bits[1] := True;
bit.Bits[2] := False;
Add(IntToStr(bit.Size)); // 3
Add(IntToStr(bit.OpenBit)); // 2 first False
finally
bit.Free;
end;
end;
end;

沒有留言:

網誌存檔