chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Steel / h / crc32
1 /*
2  * crc32.c
3  *
4  * Calculates 32-bit CRCs (Cyclic Redundancy Checks)
5  *
6  * © 1993-1998 Straylight
7  */
8
9 /*----- Licensing note ----------------------------------------------------*
10  *
11  * This file is part of Straylight's Steel library.
12  *
13  * Steel is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * Steel is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Steel.  If not, write to the Free Software Foundation,
25  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 #ifndef __crc32_h
29 #define __crc32_h
30
31 #ifndef __stddef_h
32   #include <stddef.h>
33 #endif
34
35 /*
36  * long crc32(long seed,void *data,size_t size,int diff)
37  *
38  * Use
39  *  Calculates the CRC for a block of data.  The system has been designed to
40  *  allow a CRC calculation to be carried out in stages, the result of 
41  *  previous calculations being used for continuation.
42  *
43  * Parameters
44  *  long seed == 0 to start a calculation, or the result from the previous
45  *    one to continue.
46  *  void *data == pointer to the data to check
47  *  size_t size == size (in bytes) of the data (just this block)
48  *  int diff == the address difference between bytes to check (normally one,
49  *    for all bytes).
50  *
51  * Returns
52  *   The CRC for all the data checked so far.
53  */
54
55 long crc32(long seed,void *data,size_t size,int diff);
56
57 #endif