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.
61 When producing C source (the
63 option), rather than a header, define the table to be
65 .B "\-c, \-\-c-source"
66 Produce a C source file which exports a symbol naming the array, instead
69 .BI "\-s, \-\-symbol=" symbol
72 This is the name of the macro defined by a header file, or the array
73 exported by a C source. The default macro name is
75 the default array name is
78 .BI "\-t, \-\-type=" type
79 Specify the element type of the array defined by a C source output. The
82 if the polynomial has degree 16 or less, or
84 otherwise. This option does nothing without the
88 .BI "\-i, \-\-include=" header
89 Request that generated C source include the named
95 .BI " #include """ header """"
98 at the top of the generated C source. The default is not to include a
99 header file. This option does nothing without the
103 .BI "\-g, \-\-guard=" macro
106 as a guard against multiple inclusion of the generated header file.
107 Inserts a pair of lines of the form
110 .BI " #ifndef " macro
111 .BI " #define " macro
114 at the top of the generated header, and a line
120 at the end. The default guard macro name is built from the output file
123 by uppercasing all alphabetic characters in the name and replacing
124 nonalphanumeric characters by underscores
126 This option does nothing with the
130 .BI "\-b, \-\-bits=" bits
131 Specifies the degree of the CRC polynomial or, equivalently, the length
132 of the generated CRC. This must be an integer between 1 and 32
133 inclusive. If it is not specified, the polynomial given by
135 is examined and an educated guess made. (Currently we choose the
136 smallest multiple of 8 which is large enough.)
138 .BI "\-B, \-\-bit-chunk=" chunk
139 Chunk size in which bits are taken from the input. The number of
140 entries in the table is precisely
141 .RI 2\*(ss chunk \*(se.
142 The default chunk size is 8.
144 .BI "\-p, \-\-polynomial=" poly
145 Specifies the CRC polynomial as an integer. The polynomial has a
146 nonzero coefficient in its
148 term if and only if bit
152 is nonzero. Note that if you want to specify the polynomial in
153 hexadecimal, you must prefix it with
155 Default polynomials of degree 16 and 32 are known.
157 .B "\-r, \-\-reverse"
158 Construct the table to compensate for unusual bit-ordering. Without
159 this option, you'd have to reverse the order of all input chunks and the
161 .SS "The table and how to use it"
162 Describing in detail the contents of the table would take too long. For
163 an example of use, see the header file
168 .I A painless guide to CRC error detection algorithms
171 Mark Wooding, <mdw@distorted.org.uk>