crc32.c

tmi2/v21.7a10/crc32.c · 656 B

From the archive tmi2_mudos_v1.tar.gz

Download the archive   « Back to the archive contents

#include "std.h"
#include "crctab.h"		/* see this file for more CRC credits and
				 * comments */

/* compute_crc32: compute a cyclic redundancy code for a buffer 'buf' of a
   given length 'len'.  This trivial little routine was written by
   John Garnett.  All of the code in crctab.h (the hard stuff) was written
   by others.  See the comments in the file (crctab.h) for the credits.
*/

UINT32
compute_crc32 P2(unsigned char *, buf, int, len)
{
    register UINT32 crc = 0xFFFFFFFFL;
    register int j;

    j = len;
    while (j--) {
	/* the UPDC32 macro uses 1st arg only once */
	crc = UPDC32((unsigned int) *buf++, crc);
    }
    return crc;
}

Site Stats

Snippets: 1791
Codebases: 571