Einzelnen Beitrag anzeigen

Assertor

Registriert seit: 4. Feb 2006
Ort: Hamburg
1.296 Beiträge
 
Turbo C++
 
#12

Re: DEC 5.2 Fehler unter Delphi 2009 (?)

  Alt 17. Dez 2008, 14:19
Lösung ist, die gesamte CRCInit() in eine Zwang-Optimierung zu setzen, anstatt nur die CRCTab:

Delphi-Quellcode:
{$IFOPT O-}{$O+}{$DEFINE NoOpt}{$ENDIF}
function CRCInit(var CRCDef: TCRCDef; CRCType: TCRCType): Boolean; register;
type
  PCRCTab = ^TCRCTab;
  TCRCTab = array[TCRCType] of packed record
    Poly,Bits,Init,FInit: Cardinal;
    Inverse: LongBool;
  end;

  procedure CRCTab;
  asm
    // Polynom Bits InitVec FinitVec Inverse
    DD $000000D1, 8, $00000000, $00000000, -1 // CRC_8 GSM/ERR
    DD $00000233, 10, $00000000, $00000000, -1 // CRC_10 ATM/OAM Cell
    DD $0000080F, 12, $00000000, $00000000, -1 // CRC_12
    DD $00008005, 16, $00000000, $00000000, -1 // CRC_16 ARC,IBM
    DD $00001021, 16, $00001D0F, $00000000, 0 // CRC_16 CCITT ITU
    DD $00008408, 16, $00000000, $00000000, -1 // CRC_16 XModem
    DD $00864CFB, 24, $00B704CE, $00000000, 0 // CRC_24
    DD $9DB11213, 32, $FFFFFFFF, $FFFFFFFF, -1 // CRC_32
    DD $04C11DB7, 32, $FFFFFFFF, $FFFFFFFF, -1 // CRC_32CCITT
    DD $04C11DB7, 32, $FFFFFFFF, $00000000, -1 // CRC_32ZModem

    // some other CRC's, not all yet verfied
    // DD $00000007, 8, $00000000, $00000000, -1 // CRC_8 ATM/HEC
    // DD $00000007, 8, $00000000, $00000000, 0 // CRC_8 the SMBus Working Group
    // DD $00004599, 15, $00000000, $00000000, -1 // CRC_15 CANBus
    // DD $00001021, 16, $00000000, $00000000, 0 // CRC_16ZModem
    // DD $00001021, 16, $0000FFFF, $00000000, 0 // CRC_16 CCITT British Aerospace
    // DD $00004003, 16, $00000000, $00000000, -1 // CRC_16 reversed
    // DD $00001005, 16, $00000000, $00000000, -1 // CRC_16 X25
    // DD $00000053, 16, $00000000, $00000000, -1 // BasicCard 16Bit CRC (sparse poly for Crypto MCU)
    // DD $000000C5, 32, $00000000, $00000000, -1 // BasicCard 32Bit CRC
  end;

begin
  with PCRCTab(@CRCTab)[CRCType] do
    Result := CRCSetup(CRCDef, Poly, Bits, Init, FInit, Inverse);
end;
{$IFDEF NoOpt}{$O-}{$ENDIF}
Dann geht es immmer. Sehr gediegenes Verhalten der Optimization, aber naja...

Gruß Assertor
Frederik
  Mit Zitat antworten Zitat