ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/crc32.h
Revision: 1.5
Committed: Thu Feb 27 16:17:16 2020 UTC (4 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-1_71, rel-1_8, rel-1_7
Changes since 1.4: +2 -0 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #ifndef __CRC32_H__
2     #define __CRC32_H__
3    
4     #ifndef _ANSI_ARGS_
5     #ifdef PROTOTYPES
6     #define _ANSI_ARGS_(c) c
7     #else
8     #define _ANSI_ARGS_(c) ()
9     #endif
10     #endif
11    
12 root 1.4 #include "ecb.h"
13    
14 root 1.1 #ifdef __cplusplus
15     extern "C" {
16     #endif
17    
18 root 1.4 typedef uint32_t crc32_t;
19 root 1.1
20 root 1.4 #define CRC32_INIT ((crc32_t)0)
21 root 1.2
22 root 1.4 crc32_t uu_crc32 _ANSI_ARGS_((crc32_t prev, const void *data, unsigned int len));
23 root 1.1 /*
24     Update a running crc with the bytes buf[0..len-1] and return the updated
25     crc. If buf is NULL, this function returns the required initial value
26     for the crc. Pre- and post-conditioning (one's complement) is performed
27     within this function so it shouldn't be done by the application.
28     Usage example:
29    
30 root 1.4 uLong crc = CRC32_INIT;
31 root 1.1
32     while (read_buffer(buffer, length) != EOF) {
33     crc = crc32(crc, buffer, length);
34     }
35     if (crc != original_crc) error();
36     */
37    
38 root 1.5 uint32_t uu_crc32_combine(uint32_t crcA, uint32_t crcB, size_t lengthB);
39    
40 root 1.1 #ifdef __cplusplus
41     }
42     #endif
43     #endif