var
a: byte;
MASK: byte;
arr : Array[0..7] of byte;
iindex : byte;
begin
a:= random($ff);
MASK := ($80-1);// ($1 shl (sizeof(a)*7) )-1
//writeln(MASK);
write('a= ');
write(a);
write('= ');
write(a div 16 );
write(',');
write(a mod 16 );
writeLn('');
//msb 1 byte to 8byte
for iindex := 7 downto 0 do
begin
if a > MASK then arr[iindex]:=1 else arr[iindex]:=0;
a:= a shl 1;
write(arr[iindex]);
end;
//writeLn('-----------');
沒有留言:
張貼留言