Thema: Delphi Bits to Byte?

Einzelnen Beitrag anzeigen

Dax
(Gast)

n/a Beiträge
 
#2

Re: Bits to Byte?

  Alt 4. Jun 2007, 17:12
Das sollte einfach sein.
Delphi-Quellcode:
var bits: array[0..7] of boolean;
  b: byte;
  i: integer;
const
  bit: array[boolean] of byte = (0, 1);

b := 0;
for i := 0 to 7 do
  b := b shl 1 or bit[bits[i]];
  Mit Zitat antworten Zitat