Mercurial > public > ostc4
annotate ostc4pack/src/crcmodel.h @ 352:1f24022345d1 fix-merge-mess
Fix merge problem
The merge in changeset 352 is simply wrong, so revert all changes
made in that merge.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Tue, 08 Oct 2019 16:35:45 +0200 |
parents | b70fae5023b4 |
children |
rev | line source |
---|---|
161
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
1 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
2 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
3 /* Author : Ross Williams (ross@guest.adelaide.edu.au.). */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
4 /* Date : 3 June 1993. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
5 /* Status : Public domain. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
6 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
7 /* Description : This is the header (.h) file for the reference */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
8 /* implementation of the Rocksoft^tm Model CRC Algorithm. For more */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
9 /* information on the Rocksoft^tm Model CRC Algorithm, see the document */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
10 /* titled "A Painless Guide to CRC Error Detection Algorithms" by Ross */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
11 /* Williams (ross@guest.adelaide.edu.au.). This document is likely to be in */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
12 /* "ftp.adelaide.edu.au/pub/rocksoft". */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
13 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
14 /* Note: Rocksoft is a trademark of Rocksoft Pty Ltd, Adelaide, Australia. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
15 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
16 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
17 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
18 /* How to Use This Package */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
19 /* ----------------------- */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
20 /* Step 1: Declare a variable of type cm_t. Declare another variable */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
21 /* (p_cm say) of type p_cm_t and initialize it to point to the first */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
22 /* variable (e.g. p_cm_t p_cm = &cm_t). */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
23 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
24 /* Step 2: Assign values to the parameter fields of the structure. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
25 /* If you don't know what to assign, see the document cited earlier. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
26 /* For example: */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
27 /* p_cm->cm_width = 16; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
28 /* p_cm->cm_poly = 0x8005L; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
29 /* p_cm->cm_init = 0L; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
30 /* p_cm->cm_refin = TRUE; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
31 /* p_cm->cm_refot = TRUE; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
32 /* p_cm->cm_xorot = 0L; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
33 /* Note: Poly is specified without its top bit (18005 becomes 8005). */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
34 /* Note: Width is one bit less than the raw poly width. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
35 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
36 /* Step 3: Initialize the instance with a call cm_ini(p_cm); */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
37 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
38 /* Step 4: Process zero or more message bytes by placing zero or more */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
39 /* successive calls to cm_nxt. Example: cm_nxt(p_cm,ch); */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
40 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
41 /* Step 5: Extract the CRC value at any time by calling crc = cm_crc(p_cm); */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
42 /* If the CRC is a 16-bit value, it will be in the bottom 16 bits. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
43 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
44 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
45 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
46 /* Design Notes */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
47 /* ------------ */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
48 /* PORTABILITY: This package has been coded very conservatively so that */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
49 /* it will run on as many machines as possible. For example, all external */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
50 /* identifiers have been restricted to 6 characters and all internal ones to */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
51 /* 8 characters. The prefix cm (for Crc Model) is used as an attempt to avoid */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
52 /* namespace collisions. This package is endian independent. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
53 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
54 /* EFFICIENCY: This package (and its interface) is not designed for */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
55 /* speed. The purpose of this package is to act as a well-defined reference */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
56 /* model for the specification of CRC algorithms. If you want speed, cook up */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
57 /* a specific table-driven implementation as described in the document cited */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
58 /* above. This package is designed for validation only; if you have found or */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
59 /* implemented a CRC algorithm and wish to describe it as a set of parameters */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
60 /* to the Rocksoft^tm Model CRC Algorithm, your CRC algorithm implementation */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
61 /* should behave identically to this package under those parameters. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
62 /* */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
63 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
64 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
65 /* The following #ifndef encloses this entire */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
66 /* header file, rendering it indempotent. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
67 #ifndef CM_DONE |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
68 #define CM_DONE |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
69 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
70 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
71 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
72 /* The following definitions are extracted from my style header file which */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
73 /* would be cumbersome to distribute with this package. The DONE_STYLE is the */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
74 /* idempotence symbol used in my style header file. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
75 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
76 #ifndef DONE_STYLE |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
77 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
78 typedef unsigned long ulong; |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
79 typedef unsigned bool; |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
80 typedef unsigned char *p_ubyte_; |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
81 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
82 #ifndef TRUE |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
83 #define FALSE 0 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
84 #define TRUE 1 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
85 #endif |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
86 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
87 /* Change to the second definition if you don't have prototypes. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
88 #define P_(A) A |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
89 /* #define P_(A) () */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
90 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
91 /* Uncomment this definition if you don't have void. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
92 /* typedef int void; */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
93 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
94 #endif |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
95 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
96 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
97 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
98 /* CRC Model Abstract Type */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
99 /* ----------------------- */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
100 /* The following type stores the context of an executing instance of the */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
101 /* model algorithm. Most of the fields are model parameters which must be */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
102 /* set before the first initializing call to cm_ini. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
103 typedef struct { |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
104 int cm_width; /* Parameter: Width in bits [8,32]. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
105 ulong cm_poly; /* Parameter: The algorithm's polynomial. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
106 ulong cm_init; /* Parameter: Initial register value. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
107 bool cm_refin; /* Parameter: Reflect input bytes? */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
108 bool cm_refot; /* Parameter: Reflect output CRC? */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
109 ulong cm_xorot; /* Parameter: XOR this to output CRC. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
110 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
111 ulong cm_reg; /* Context: Context during execution. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
112 } cm_t; |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
113 typedef cm_t *p_cm_t; |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
114 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
115 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
116 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
117 /* Functions That Implement The Model */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
118 /* ---------------------------------- */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
119 /* The following functions animate the cm_t abstraction. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
120 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
121 void cm_ini P_((p_cm_t p_cm)); |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
122 /* Initializes the argument CRC model instance. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
123 /* All parameter fields must be set before calling this. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
124 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
125 void cm_nxt P_((p_cm_t p_cm, int ch)); |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
126 /* Processes a single message byte [0,255]. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
127 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
128 void cm_blk P_((p_cm_t p_cm, p_ubyte_ blk_adr, ulong blk_len)); |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
129 /* Processes a block of message bytes. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
130 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
131 ulong cm_crc P_((p_cm_t p_cm)); |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
132 /* Returns the CRC value for the message bytes processed so far. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
133 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
134 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
135 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
136 /* Functions For Table Calculation */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
137 /* ------------------------------- */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
138 /* The following function can be used to calculate a CRC lookup table. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
139 /* It can also be used at run-time to create or check static tables. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
140 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
141 ulong cm_tab P_((p_cm_t p_cm, int index)); |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
142 /* Returns the i'th entry for the lookup table for the specified algorithm. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
143 /* The function examines the fields cm_width, cm_poly, cm_refin, and the */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
144 /* argument table index in the range [0,255] and returns the table entry in */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
145 /* the bottom cm_width bytes of the return value. */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
146 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
147 /******************************************************************************/ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
148 |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
149 /* End of the header file idempotence #ifndef */ |
b70fae5023b4
Add missing file for self build pack tools
Jan Mulder <jlmulder@xs4all.nl>
parents:
diff
changeset
|
150 #endif |