You're right, of course.

In any case, I discovered my own error:  I was actually calculating a
_reverse_ crc-16 manually, which uses a different generator polynomial.

> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, March 19, 1999 17:24
> To:   [EMAIL PROTECTED]
> Subject:      RE: Crc16CalcBlock
> 
> >Yes, I seeded it with 0.  Here's the code I used:
> >
> >    UInt16  crc16;
> >    Byte    crcMSB, crcLSB;
> >    Byte    *byteP;
> >
> >    crc16 = Crc16CalcBlock(inputStr, StrLen(inputStr), 0);
> >
> >    byteP = (Byte *)(&crc16);
> >
> >    crcLSB = *(byteP);
> >
> >    byteP++;
> >    crcMSB = *(byteP);
> >
> >With inputStr pointing at "The", MSB ends up with 0x8e, LSB with 0x3c.
> They
> >should be 0x3b and 0xae, respectively.  Any suggestions?  Thanks for your
> help...
> 
> 
> I don't know about the actual values you're getting from Crc16CalcBlock
> (though they match a Crc routine that I once got from another source).
> However, your method for getting the individual bytes from crc16 could be
> better.  Using:
> 
>      crcLSB = (Byte) crc16;
>      crcMSB = (Byte) (crc16 >> 8);
> 
> protects you from the endian-ness of the processor.
> 
> -- Keith Rollin
> -- Palm OS Emulator engineer
> 
> 
> 

Reply via email to