10 .TH crc-mktab 1 "9 November 2003" "Straylight/Edgeware" "mLib utilities library"
12 crc-mktab \- construct CRC tables for efficient computation
39 program constructs tables for efficient computation of CRC (cyclic
40 redundancy check) values. It will produce the table as either an array
41 defined in a C source file or as an initializer macro defined in a C
44 The program accepts no non-option arguments. At least one of
48 must be given. The options are as follows.
51 Print a help message to standard output and exit successfully.
54 Print the program's version number to standard output and exit
58 Print a one-line usage summary to standard output and exit successfully.
60 .B "\-c, \-\-c-source"
61 Produce a C source file which exports a symbol naming the array, instead
64 .BI "\s, \-\-symbol=" symbol
67 This is the name of the macro defined by a header file, or the array
68 exported by a C source. The default macro name is
70 the default array name is
73 .BI "\-t, \-\-type=" type
74 Specify the element type of the array defined by a C source output. The
77 if the polynomial has degree 16 or less, or
79 otherwise. This option does nothing without the
83 .BI "\-i, \-\-include=" header
84 Request that generated C source include the named
90 .BI " #include """ header """"
93 at the top of the generated C source. The default is not to include a
94 header file. This option does nothing without the
98 .BI "\-g, \-\-guard=" macro
101 as a guard against multiple inclusion of the generated header file.
102 Inserts a pair of lines of the form
105 .BI " #ifndef " macro
106 .BI " #define " macro
109 at the top of the generated header, and a line
115 at the end. The default guard macro name is built from the output file
118 by uppercasing all alphabetic characters in the name and replacing
119 nonalphanumeric characters by underscores
121 This option does nothing with the
125 .BI "\-b, \-\-bits=" bits
126 Specifies the degree of the CRC polynomial or, equivalently, the length
127 of the generated CRC. This must be an integer between 1 and 32
128 inclusive. If it is not specified, the polynomial given by
130 is examined and an educated guess made. (Currently we choose the
131 smallest multiple of 8 which is large enough.)
133 .BI "\-B, \-\-bit-chunk=" chunk
134 Chunk size in which bits are taken from the input. The number of
135 entries in the table is precisely
136 .RI 2\*(ss chunk \*(se.
137 The default chunk size is 8.
139 .BI "\-p, \-\-polynomial=" poly
140 Specifies the CRC polynomial as an integer. The polynomial has a
141 nonzero coefficient in its
143 term if and only if bit
147 is nonzero. Note that if you want to specify the polynomial in
148 hexadecimal, you must prefix it with
150 Default polynomials of degree 16 and 32 are known.
152 .B "\-r, \-\-reverse"
153 Construct the table to compensate for unusual bit-ordering. Without
154 this option, you'd have to reverse the order of all input chunks and the
156 .SS "The table and how to use it"
157 Describing in detail the contents of the table would take too long. For
158 an example of use, see the header file
163 .I A painless guide to CRC error detection algorithms
166 Mark Wooding, <mdw@nsict.org>