ScummVM API documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
crc.h
1
/**********************************************************************
2
*
3
* Filename: crc.h
4
*
5
* Description: A header file describing the various CRC standards.
6
*
7
* Notes:
8
*
9
*
10
* Copyright (c) 2000 by Michael Barr. This software is placed into
11
* the public domain and may be used for any purpose. However, this
12
* notice must not be changed or removed and no warranty is either
13
* expressed or implied by its publication or distribution.
14
**********************************************************************/
15
16
#ifndef _crc_h
17
#define _crc_h
18
19
#include "common/system.h"
// For types.
20
21
namespace
Wintermute
{
22
23
#ifndef TRUE
24
#define FALSE 0
25
#define TRUE !FALSE
26
#endif
27
28
/*
29
* Select the CRC standard from the list that follows.
30
*/
31
#define CRC32
32
33
#if defined(CRC_CCITT)
34
35
typedef
uint16 crc;
36
37
#define CRC_NAME "CRC-CCITT"
38
#define POLYNOMIAL 0x1021
39
#define INITIAL_REMAINDER 0xFFFF
40
#define FINAL_XOR_VALUE 0x0000
41
#define REFLECT_DATA FALSE
42
#define REFLECT_REMAINDER FALSE
43
#define CHECK_VALUE 0x29B1
44
45
#elif defined(CRC16)
46
47
typedef
uint16 crc;
48
49
#define CRC_NAME "CRC-16"
50
#define POLYNOMIAL 0x8005
51
#define INITIAL_REMAINDER 0x0000
52
#define FINAL_XOR_VALUE 0x0000
53
#define REFLECT_DATA TRUE
54
#define REFLECT_REMAINDER TRUE
55
#define CHECK_VALUE 0xBB3D
56
57
#elif defined(CRC32)
58
59
typedef
uint32 crc;
60
61
#define CRC_NAME "CRC-32"
62
#define POLYNOMIAL 0x04C11DB7
63
#define INITIAL_REMAINDER 0xFFFFFFFF
64
#define FINAL_XOR_VALUE 0xFFFFFFFF
65
#define REFLECT_DATA TRUE
66
#define REFLECT_REMAINDER TRUE
67
#define CHECK_VALUE 0xCBF43926
68
69
#else
70
71
#error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
72
73
#endif
74
75
void
crcInit();
76
crc crcSlow(
unsigned
char
const
message[],
int
nBytes);
77
crc crcFast(
unsigned
char
const
message[],
int
nBytes);
78
79
extern
"C"
crc crc_initialize();
80
extern
"C"
crc crc_process_byte(
unsigned
char
byteVal, crc remainder);
81
extern
"C"
crc crc_finalize(crc remainder);
82
83
}
// End of namespace Wintermute
84
85
#endif
/* _crc_h */
Wintermute
Definition:
achievements_tables.h:27
engines
wintermute
utils
crc.h
Generated on Mon Apr 7 2025 09:05:42 for ScummVM API documentation by
1.8.13