<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 12 Jun 2011 18:06:32 +0200
From   : rick@... (Rick Murray)
Subject: Calculating CRCs

On 12/06/2011 04:00, J.G.Harston wrote:

> I spent about four hours a couple of days ago thrashing the interweb
> looking for code to update the CRC code in BBCZip, and failed. Just
> try it yourself, enter "CRC-32" or "CRC32" into Gurgle. Plently of
> 'download a commandline utility to calculate a CRC-32 on a file',
> or detail theoretical analysis of what polynomial CRC calculation is,
> no actual code.

:-)

Google -> "crc 32 source code".

Take your pick. Fifth link down is:
   http://www.netrino.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

which explains by bit, by byte, and differences in various types of CRC. 
As it is for embedded systems, it uses direct lookup, not table-based.


> Ended up with a 50% increase in speed, and the filesystem access is
> the limiting speed factor now.

Cool.


> I specifically *didn't* want a table version,

Indeed, that is something to consider on the Beeb - can you justify 
losing that much space to a lookup table?


> Nothing about actually **WRITING** a CRC calculator.

Because you were not specific enough in your search.

   "xmodem crc calculation code"

Ignore softwareinformer links. There's an overview of XModem at:
   http://www.techfest.com/hardware/modem/xymodem.htm
page 26 gives C code for CRC-16.


Took me four minutes to find CRC-16 code in 6502 and ARM:
   http://regregex.bbcmicro.net/crc-catalogue.htm#appendix.b

;-)


> Sprow wrote:
>> In the C implementation I don't see what
>> crc &= 0xFFFFFFFF;
>> does.
> I'm not sure, that's from my original notes from the very first version
> of BBCZip back in about 1997.

That clips a 32 bit unsigned value to a 32 bit unsigned value - which is 
probably not going to be necessary unless you have 64 bit capacity (else 
it'd just overflow and do this by itself...).


Best wishes,

Rick.

-- 
Rick Murray, eeePC901 & ADSL WiFI'd into it, all ETLAs!
BBC B: DNFS, 2 x 5.25" floppies, EPROM prog, Acorn TTX
E01S FileStore, A3000/A5000/RiscPC/various PCs/blahblah...
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>