procedure TBitFolge.fromByte(b : byte);
var
i : byte;
begin
for i := 8 downto 1 do
begin
if b mod 2 = 1 then Bits[i] := Eins else Bits[i] := Null;
b := b div 2;
end;
end;
function TBitFolge.toByte : byte;
var
wert,stellenwert,i : byte;
begin
wert := 0; stellenwert := 1;
for i := 8 downto 1 do
begin
if Bits[i] = Eins then wert := wert + stellenwert;
stellenwert := 2*stellenwert;
end;
result := wert;
end;
procedure TBitFolge.fromChar(ch : char);
begin
fromByte(ord(ch));
end;
function TBitFolge.toChar : char;
begin
result := chr(toByte);
end;
|