Hi Leute,
anbei eine kleine "Lookup" Tabelle, die die Bitreihenfolge innerhalb eines Bytes mittels Case-Anweisung swapt. Gegebenenfalls spart sich so jemand Tipparbeit
Delphi-Quellcode:
function SwapByte (
Const Value : Byte) : Byte;
begin
case Value
of
$00 : Result := $00;
$01 : Result := $80;
$02 : Result := $40;
$03 : Result := $C0;
$04 : Result := $20;
$05 : Result := $A0;
$06 : Result := $60;
$07 : Result := $E0;
$08 : Result := $10;
$09 : Result := $90;
$0A : Result := $50;
$0B : Result := $D0;
$0C : Result := $30;
$0D : Result := $B0;
$0E : Result := $70;
$0F : Result := $F0;
$10 : Result := $08;
$11 : Result := $88;
$12 : Result := $48;
$13 : Result := $C8;
$14 : Result := $28;
$15 : Result := $A8;
$16 : Result := $68;
$17 : Result := $E8;
$18 : Result := $18;
$19 : Result := $98;
$1A : Result := $58;
$1B : Result := $D8;
$1C : Result := $38;
$1D : Result := $B8;
$1E : Result := $78;
$1F : Result := $F8;
$20 : Result := $04;
$21 : Result := $84;
$22 : Result := $44;
$23 : Result := $C4;
$24 : Result := $24;
$25 : Result := $A4;
$26 : Result := $64;
$27 : Result := $E4;
$28 : Result := $14;
$29 : Result := $94;
$2A : Result := $54;
$2B : Result := $D4;
$2C : Result := $34;
$2D : Result := $B4;
$2E : Result := $74;
$2F : Result := $F4;
$30 : Result := $0C;
$31 : Result := $8C;
$32 : Result := $4C;
$33 : Result := $
CC;
$34 : Result := $2C;
$35 : Result := $AC;
$36 : Result := $6C;
$37 : Result := $
EC;
$38 : Result := $1C;
$39 : Result := $9C;
$3A : Result := $5C;
$3B : Result := $
DC;
$3C : Result := $3C;
$3D : Result := $BC;
$3E : Result := $7C;
$3F : Result := $FC;
$40 : Result := $02;
$41 : Result := $82;
$42 : Result := $42;
$43 : Result := $C2;
$44 : Result := $22;
$45 : Result := $A2;
$46 : Result := $62;
$47 : Result := $E2;
$48 : Result := $12;
$49 : Result := $92;
$4A : Result := $52;
$4B : Result := $D2;
$4C : Result := $32;
$4D : Result := $B2;
$4E : Result := $72;
$4F : Result := $F2;
$50 : Result := $0A;
$51 : Result := $8A;
$52 : Result := $4A;
$53 : Result := $CA;
$54 : Result := $2A;
$55 : Result := $AA;
$56 : Result := $6A;
$57 : Result := $EA;
$58 : Result := $1A;
$59 : Result := $9A;
$5A : Result := $5A;
$5B : Result := $DA;
$5C : Result := $3A;
$5D : Result := $BA;
$5E : Result := $7A;
$5F : Result := $FA;
$60 : Result := $06;
$61 : Result := $86;
$62 : Result := $46;
$63 : Result := $C6;
$64 : Result := $26;
$65 : Result := $A6;
$66 : Result := $66;
$67 : Result := $E6;
$68 : Result := $16;
$69 : Result := $96;
$6A : Result := $56;
$6B : Result := $D6;
$6C : Result := $36;
$6D : Result := $B6;
$6E : Result := $76;
$6F : Result := $F6;
$70 : Result := $0E;
$71 : Result := $8E;
$72 : Result := $4E;
$73 : Result := $CE;
$74 : Result := $2E;
$75 : Result := $AE;
$76 : Result := $6E;
$77 : Result := $EE;
$78 : Result := $1E;
$79 : Result := $9E;
$7A : Result := $5E;
$7B : Result := $DE;
$7C : Result := $3E;
$7D : Result := $BE;
$7E : Result := $7E;
$7F : Result := $FE;
$80 : Result := $01;
$81 : Result := $81;
$82 : Result := $41;
$83 : Result := $C1;
$84 : Result := $21;
$85 : Result := $A1;
$86 : Result := $61;
$87 : Result := $E1;
$88 : Result := $11;
$89 : Result := $91;
$8A : Result := $51;
$8B : Result := $D1;
$8C : Result := $31;
$8D : Result := $B1;
$8E : Result := $71;
$8F : Result := $F1;
$90 : Result := $09;
$91 : Result := $89;
$92 : Result := $49;
$93 : Result := $C9;
$94 : Result := $29;
$95 : Result := $A9;
$96 : Result := $69;
$97 : Result := $E9;
$98 : Result := $19;
$99 : Result := $99;
$9A : Result := $59;
$9B : Result := $D9;
$9C : Result := $39;
$9D : Result := $B9;
$9E : Result := $79;
$9F : Result := $F9;
$A0 : Result := $05;
$A1 : Result := $85;
$A2 : Result := $45;
$A3 : Result := $C5;
$A4 : Result := $25;
$A5 : Result := $A5;
$A6 : Result := $65;
$A7 : Result := $E5;
$A8 : Result := $15;
$A9 : Result := $95;
$AA : Result := $55;
$AB : Result := $D5;
$AC : Result := $35;
$AD : Result := $B5;
$AE : Result := $75;
$AF : Result := $F5;
$B0 : Result := $0D;
$B1 : Result := $8D;
$B2 : Result := $4D;
$B3 : Result := $CD;
$B4 : Result := $2D;
$B5 : Result := $AD;
$B6 : Result := $6D;
$B7 : Result := $ED;
$B8 : Result := $1D;
$B9 : Result := $9D;
$BA : Result := $5D;
$BB : Result := $DD;
$BC : Result := $3D;
$BD : Result := $BD;
$BE : Result := $7D;
$BF : Result := $FD;
$C0 : Result := $03;
$C1 : Result := $83;
$C2 : Result := $43;
$C3 : Result := $C3;
$C4 : Result := $23;
$C5 : Result := $A3;
$C6 : Result := $63;
$C7 : Result := $E3;
$C8 : Result := $13;
$C9 : Result := $93;
$CA : Result := $53;
$CB : Result := $D3;
$
CC : Result := $33;
$CD : Result := $B3;
$CE : Result := $73;
$CF : Result := $F3;
$D0 : Result := $0B;
$D1 : Result := $8B;
$D2 : Result := $4B;
$D3 : Result := $CB;
$D4 : Result := $2B;
$D5 : Result := $AB;
$D6 : Result := $6B;
$D7 : Result := $EB;
$D8 : Result := $1B;
$D9 : Result := $9B;
$DA : Result := $5B;
$
DB : Result := $
DB;
$
DC : Result := $3B;
$DD : Result := $BB;
$DE : Result := $7B;
$
DF : Result := $
FB;
$E0 : Result := $07;
$E1 : Result := $87;
$E2 : Result := $47;
$E3 : Result := $C7;
$E4 : Result := $27;
$E5 : Result := $A7;
$E6 : Result := $67;
$E7 : Result := $E7;
$E8 : Result := $17;
$E9 : Result := $97;
$EA : Result := $57;
$EB : Result := $D7;
$
EC : Result := $37;
$ED : Result := $B7;
$EE : Result := $77;
$EF : Result := $F7;
$F0 : Result := $0F;
$F1 : Result := $8F;
$F2 : Result := $4F;
$F3 : Result := $CF;
$F4 : Result := $2F;
$F5 : Result := $AF;
$F6 : Result := $6F;
$F7 : Result := $EF;
$F8 : Result := $1F;
$F9 : Result := $9F;
$FA : Result := $5F;
$
FB : Result := $
DF;
$FC : Result := $3F;
$FD : Result := $BF;
$FE : Result := $7F;
$FF : Result := $FF;
end;
end;
Gruß,
Peter