<?xml version="1.0" standalone="yes"?>
<library-reference><header id="doxygen.crc_8hpp" name="boost/crc.hpp">
<para>A collection of function templates and class templates that compute various forms of Cyclic Redundancy Codes (CRCs). </para><para><para>Daryle Walker</para>

<para>1.5</para>

<para>Boost Software License, version 1.0</para>

Contains the declarations (and definitions) of various kinds of CRC computation functions, function object types, and encapsulated policy types.</para><para><warning><para>The sample CRC-computer types were just checked against the <ulink url="http://regregex.bbcmicro.net/crc-catalogue.htm">Catalogue of parametrised CRC algorithms</ulink>. New type aliases were added where I got a standard wrong. However, the mistaken <computeroutput>typedef</computeroutput>s are still there for backwards compatibility. </para>
</warning>
<note><para>There are references to the <emphasis>Rocksoft<trademark/> Model CRC Algorithm</emphasis>, as described within "A Painless Guide to CRC Error Detection Algorithms," linked from "<ulink url="http://www.ross.net/crc/crcpaper.html">CRC: A Paper On CRCs</ulink>" by Ross Williams. It will be abbreviated "RMCA" in other documentation blocks. </para>
</note>
</para><namespace name="boost">
<class id="doxygen.classboost_1_1crc__basic" name="crc_basic"><template>
      <template-nontype-parameter name="Bits"><type>std::size_t</type><purpose><para>The order of the modulo-2 polynomial divisor. (<emphasis>Width</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
    </template><purpose>Bit-wise CRC computer. </purpose><description><para>Objects of this type compute the CRC checksum of submitted data, where said data can be entered piecemeal through several different kinds of groupings. Modulo-2 polynomial division steps are always performed bit-wise, without the use of pre-computation tables. Said division uses the altered algorithm, so any data has to be unaugmented.</para><para>

</para></description><typedef id="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4" name="value_type"><purpose>The register type used for computations. </purpose><description><para>This type is used for CRC calculations and is the type for any returned checksums and returned or submitted remainders, (truncated) divisors, or XOR masks. It is a built-in unsigned integer type. </para></description><type><emphasis>unspecified</emphasis></type></typedef>
<data-member id="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79" name="bit_count" specifiers="static"><type>const std::size_t</type><purpose>A copy of <emphasis>Bits</emphasis> provided for meta-programming purposes. </purpose></data-member>
<method-group name="public member functions">
<constructor id="doxygen.classboost_1_1crc__basic_1a9cae2e76fcd50193af8fffd4b43abd12" specifiers="explicit"><parameter name="truncated_polynomial"><paramtype>value_type</paramtype><description><para>The lowest coefficients of the divisor polynomial. The highest-order coefficient is omitted and always assumed to be 1. (<emphasis>Poly</emphasis> from the RMCA) </para></description></parameter><parameter name="initial_remainder"><paramtype>value_type</paramtype><default>0</default><description><para>The (unaugmented) initial state of the polynomial remainder. Defaults to <computeroutput>0</computeroutput> if omitted. (<emphasis>Init</emphasis> from the RMCA) </para></description></parameter><parameter name="final_xor_value"><paramtype>value_type</paramtype><default>0</default><description><para>The (XOR) bit-mask to be applied to the output remainder, after possible reflection but before returning. Defaults to <computeroutput>0</computeroutput> (i.e. no bit changes) if omitted. (<emphasis>XorOut</emphasis> from the RMCA) </para></description></parameter><parameter name="reflect_input"><paramtype>bool</paramtype><default>false</default><description><para>If <computeroutput>true</computeroutput>, input bytes are read lowest-order bit first, otherwise highest-order bit first. Defaults to <computeroutput>false</computeroutput> if omitted. (<emphasis>RefIn</emphasis> from the RMCA) </para></description></parameter><parameter name="reflect_remainder"><paramtype>bool</paramtype><default>false</default><description><para>If <computeroutput>true</computeroutput>, the output remainder is reflected before the XOR-mask. Defaults to <computeroutput>false</computeroutput> if omitted. (<emphasis>RefOut</emphasis> from the RMCA)</para></description></parameter><purpose>Create a computer, separately listing each needed parameter. </purpose><description><para>Constructs a <computeroutput><link linkend="doxygen.classboost_1_1crc__basic">crc_basic</link></computeroutput> object with at least the required parameters to a particular CRC formula to be processed upon receiving input.</para><para>







</para></description><postconditions><para><computeroutput><emphasis>truncated_polynomial</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a666ae27413ed3077f529a0948fad796b">get_truncated_polynominal()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>initial_remainder</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>final_xor_value</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>reflect_input</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>reflect_remainder</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>initial_remainder</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput>(<emphasis>reflect_remainder</emphasis> ? REFLECT(<emphasis>initial_remainder</emphasis>) : <emphasis>initial_remainder</emphasis>) ^ <emphasis>final_xor_value</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</link></computeroutput> </para>
</postconditions></constructor>
<method id="doxygen.classboost_1_1crc__basic_1a666ae27413ed3077f529a0948fad796b" name="get_truncated_polynominal" cv="const"><type>value_type</type><purpose>Return the (truncated) polynomial divisor. </purpose><description><para>Returns a representation of the polynomial divisor. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term. The omitted bit for x<superscript>(<link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>)</superscript> term is always 1.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>, the values of higher-placed bits should be ignored (even any for x<superscript>(<link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>)</superscript>) since they're unregulated. </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a" name="get_initial_remainder" cv="const"><type>value_type</type><purpose>Return what the polynomial remainder was set to during construction. </purpose><description><para>Returns a representation of the polynomial remainder before any input has been submitted. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated. </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89" name="get_final_xor_value" cv="const"><type>value_type</type><purpose>Return the XOR-mask used during output processing. </purpose><description><para>Returns the mask to be used during creation of a checksum. The mask is used for an exclusive-or (XOR) operation applied bit-wise to the interim remainder representation (after any reflection, if <link linkend="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</link> returns <computeroutput>true</computeroutput>).</para><para>
</para></description><returns><para>The bit-mask. If the bit-length of <link linkend="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated. </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c" name="get_reflect_input" cv="const"><type>bool</type><purpose>Check if input-bytes will be reflected before processing. </purpose><description><para>Returns whether or not a submitted byte will be "reflected" before it is used to update the interim remainder. Only the byte-wise operations <link linkend="doxygen.classboost_1_1crc__basic_1a8b58f66aa6b73bd844c9a26e04802cca">process_byte</link>, <link linkend="doxygen.classboost_1_1crc__basic_1aa3638d0043a80cf4ab9a31e4bf37edc5">process_block</link>, and <link linkend="doxygen.classboost_1_1crc__basic_1a8c303374e0b96947b973a5dd140d525d">process_bytes</link> are affected.</para><para>
</para></description></method>
<method id="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc" name="get_reflect_remainder" cv="const"><type>bool</type><purpose>Check if the remainder will be reflected during output processing. </purpose><description><para>Indicates if the interim remainder will be "reflected" before it is passed to the XOR-mask stage when returning a checksum.</para><para>
</para></description></method>
<method id="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499" name="get_interim_remainder" cv="const"><type>value_type</type><purpose>Return the remainder based from already-processed bits. </purpose><description><para>Returns a representation of the polynomial remainder after all the input submissions since construction or the last <link linkend="doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset</link> call. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term. If CRC processing gets interrupted here, retain the value returned, and use it to start up the next CRC computer where you left off (with <link linkend="doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset(value_type)</link> or construction). The next computer has to have its other parameters compatible with this computer.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated. No output processing (reflection or XOR mask) has been applied to the value. </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96" name="reset"><type>void</type><parameter name="new_rem"><paramtype>value_type</paramtype><description><para>The (unaugmented) state of the polynomial remainder starting from this point, with no output processing applied.</para></description></parameter><purpose>Change the interim remainder to a new value. </purpose><description><para>Changes the interim polynomial remainder to <emphasis>new_rem</emphasis>, purging any influence previously submitted input has had. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term.</para><para>


</para></description><postconditions><para><computeroutput><emphasis>new_rem</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput>((this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</link> ? REFLECT(<emphasis>new_rem</emphasis>) : <emphasis>new_rem</emphasis>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</link>) == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</link></computeroutput> </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1aefbd1069b4231de1409fc2d89103db7f" name="reset"><type>void</type><purpose>Change the interim remainder back to the initial value. </purpose><description><para>Changes the interim polynomial remainder to the initial remainder given during construction, purging any influence previously submitted input has had. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term.</para><para>

</para></description><postconditions><para><computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput>((this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</link> ? REFLECT(this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</link>) : this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</link>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</link>) == this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</link></computeroutput> </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1a1f4f4b5c43131d9ba244087dd47fc454" name="process_bit"><type>void</type><parameter name="bit"><paramtype>bool</paramtype><description><para>The new input bit.</para></description></parameter><purpose>Submit a single bit for input processing. </purpose><description><para>Updates the interim remainder with a single altered-CRC-division step.</para><para>

</para></description><postconditions><para>The interim remainder is updated through a modulo-2 polynomial division, where the division steps are altered for unaugmented CRCs. </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1ab44a8ec101bf5683b6067518642abf50" name="process_bits"><type>void</type><parameter name="bits"><paramtype>unsigned char</paramtype><description><para>The byte containing the new input bits. </para></description></parameter><parameter name="bit_length"><paramtype>std::size_t</paramtype><description><para>The number of bits in the byte to be read.</para></description></parameter><purpose>Submit the lowest <emphasis>bit_length</emphasis> bits of a byte for input processing. </purpose><description><para>Updates the interim remainder with several altered-CRC-division steps. Each bit is processed separately, starting from the one at the 2<superscript><emphasis>bit_length</emphasis> - 1</superscript> place, then proceeding down to the lowest-placed bit. Any order imposed by <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</link></computeroutput> is ignored.</para><para>


</para></description><requires><para>0 &lt; <emphasis>bit_length</emphasis> &lt;= <computeroutput>CHAR_BIT</computeroutput> </para>
</requires><postconditions><para>The interim remainder is updated through <emphasis>bit_length</emphasis> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1a8b58f66aa6b73bd844c9a26e04802cca" name="process_byte"><type>void</type><parameter name="byte"><paramtype>unsigned char</paramtype><description><para>The new input byte.</para></description></parameter><purpose>Submit a single byte for input processing. </purpose><description><para>Updates the interim remainder with a byte's worth of altered-CRC-division steps. The bits within the byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise.</para><para>

</para></description><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT</computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1aa3638d0043a80cf4ab9a31e4bf37edc5" name="process_block"><type>void</type><parameter name="bytes_begin"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="bytes_end"><paramtype>void const *</paramtype><description><para>Points to one-byte past the address of the memory block's last byte, or <emphasis>bytes_begin</emphasis> if no bytes are to be read.</para></description></parameter><purpose>Submit a memory block for input processing, iterator-pair style. </purpose><description><para>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <emphasis>bytes_begin</emphasis> until <emphasis>bytes_end</emphasis> is reached through forward iteration, treating the two pointers as if they point to <computeroutput>unsigned char</computeroutput> objects.</para><para>




</para></description><requires><para><emphasis>bytes_end</emphasis> has to equal <emphasis>bytes_begin</emphasis> if the latter is <computeroutput>NULL</computeroutput> or otherwise doesn't point to a valid buffer. </para>
</requires><requires><para><emphasis>bytes_end</emphasis>, if not equal to <emphasis>bytes_begin</emphasis>, has to point within or one-byte-past the same buffer <emphasis>bytes_begin</emphasis> points into. </para>
</requires><requires><para><emphasis>bytes_end</emphasis> has to be reachable from <emphasis>bytes_begin</emphasis> through a finite number of forward byte-pointer increments.</para>
</requires><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT * (((unsigned char const *) bytes_end) - ((unsigned char const *) bytes_begin))</computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1a8c303374e0b96947b973a5dd140d525d" name="process_bytes"><type>void</type><parameter name="buffer"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="byte_count"><paramtype>std::size_t</paramtype><description><para>The number of bytes in the memory block.</para></description></parameter><purpose>Submit a memory block for input processing, pointer-and-size style. </purpose><description><para>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <emphasis>buffer</emphasis>, forward-iterated (as if the pointed-to objects were of <computeroutput>unsigned char</computeroutput>) until <emphasis>byte_count</emphasis> bytes are read.</para><para>



</para></description><requires><para><emphasis>byte_count</emphasis> has to equal 0 if <emphasis>buffer</emphasis> is <computeroutput>NULL</computeroutput> or otherwise doesn't point to valid memory. </para>
</requires><requires><para>If <emphasis>buffer</emphasis> points within valid memory, then that block has to have at least <emphasis>byte_count</emphasis> more valid bytes allocated from that point.</para>
</requires><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT * <emphasis>byte_count</emphasis></computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1" name="checksum" cv="const"><type>value_type</type><purpose>Return the checksum of the already-processed bits. </purpose><description><para>Computes the checksum of all the submitted bits since construction or the last call to <link linkend="doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset</link>. The checksum will be the raw checksum, i.e. the (interim) remainder after all the modulo-2 polynomial division, plus any output processing.</para><para>
<note><para>Since checksums are meant to be compared, any higher-placed bits (when the bit-length of <link linkend="doxygen.classboost_1_1crc__basic_1aa28ad85d498858963629e7da771e08c4">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__basic_1a782d9f0dca937238f22992557069ec79">bit_count</link>) will be set to 0. </para>
</note>
</para></description><returns><para><computeroutput>(this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</link> ? REFLECT(this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</link>) : this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</link>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</link></computeroutput></para>
</returns></method>
</method-group>
</class><class id="doxygen.classboost_1_1crc__optimal" name="crc_optimal"><template>
      <template-nontype-parameter name="Bits"><type>std::size_t</type><purpose><para>The order of the modulo-2 polynomial divisor. (<emphasis>Width</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
      <template-nontype-parameter name="TruncPoly"><type><emphasis>unspecified</emphasis></type><purpose><para>The lowest coefficients of the divisor polynomial. The highest-order coefficient is omitted and always assumed to be 1. Defaults to <computeroutput>0</computeroutput>, i.e. the only non-zero term is the implicit one for x<superscript><emphasis>Bits</emphasis></superscript>. (<emphasis>Poly</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
      <template-nontype-parameter name="InitRem"><type><emphasis>unspecified</emphasis></type><purpose><para>The (unaugmented) initial state of the polynomial remainder. Defaults to <computeroutput>0</computeroutput> if omitted. (<emphasis>Init</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
      <template-nontype-parameter name="FinalXor"><type><emphasis>unspecified</emphasis></type><purpose><para>The (XOR) bit-mask to be applied to the output remainder, after possible reflection but before returning. Defaults to <computeroutput>0</computeroutput> (i.e. no bit changes) if omitted. (<emphasis>XorOut</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
      <template-nontype-parameter name="ReflectIn"><type>bool</type><purpose><para>If <computeroutput>true</computeroutput>, input bytes are read lowest-order bit first, otherwise highest-order bit first. Defaults to <computeroutput>false</computeroutput> if omitted. (<emphasis>RefIn</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
      <template-nontype-parameter name="ReflectRem"><type>bool</type><purpose><para>If <computeroutput>true</computeroutput>, the output remainder is reflected before the XOR-mask. Defaults to <computeroutput>false</computeroutput> if omitted. (<emphasis>RefOut</emphasis> from the RMCA)</para></purpose></template-nontype-parameter>
    </template><purpose>Table-driven CRC computer, usable as a function object. </purpose><description><para>Objects of this type compute the CRC checksum of submitted data, where said data can be entered piecemeal through several different kinds of groupings. Modulo-2 polynomial division steps are performed byte-wise, aided by the use of pre-computation tables. Said division uses the altered algorithm, so any data has to be unaugmented.</para><para>

<xrefsect id="todo_1_todo000001"><xreftitle>Todo</xreftitle><xrefdescription><para>Get rid of the default value for <emphasis>TruncPoly</emphasis>. Choosing a divisor is an important decision with many factors, so a default is never useful, especially a bad one. </para>
</xrefdescription></xrefsect></para></description><typedef id="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f" name="value_type"><purpose>The register type used for computations.    </purpose><description><para>This type is used for CRC calculations and is the type for any returned checksums and returned or submitted remainders, (truncated) divisors, or XOR masks. It is a built-in unsigned integer type.    </para></description><type><emphasis>unspecified</emphasis></type></typedef>
<data-member id="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745" name="bit_count" specifiers="static"><type>const std::size_t</type><purpose>A copy of <emphasis>Bits</emphasis> provided for meta-programming purposes.    </purpose></data-member>
<data-member id="doxygen.classboost_1_1crc__optimal_1a2647a5458a3852af10275f20d2fe50a4" name="truncated_polynominal" specifiers="static"><type>const value_type</type><purpose>A copy of <emphasis>TruncPoly</emphasis> provided for meta-programming purposes. </purpose></data-member>
<data-member id="doxygen.classboost_1_1crc__optimal_1a2497f9010a8b85f40365ced74dc664c4" name="initial_remainder" specifiers="static"><type>const value_type</type><purpose>A copy of <emphasis>InitRem</emphasis> provided for meta-programming purposes. </purpose></data-member>
<data-member id="doxygen.classboost_1_1crc__optimal_1af970b528f3afc9e6c53715c5b3f7aa54" name="final_xor_value" specifiers="static"><type>const value_type</type><purpose>A copy of <emphasis>FinalXor</emphasis> provided for meta-programming purposes. </purpose></data-member>
<data-member id="doxygen.classboost_1_1crc__optimal_1a23cc18cd925388ba2e612a9366467dec" name="reflect_input" specifiers="static"><type>const bool</type><purpose>A copy of <emphasis>ReflectIn</emphasis> provided for meta-programming purposes. </purpose></data-member>
<data-member id="doxygen.classboost_1_1crc__optimal_1a81908654cb154ae10f8cfa5644daf16d" name="reflect_remainder" specifiers="static"><type>const bool</type><purpose>A copy of <emphasis>ReflectRem</emphasis> provided for meta-programming purposes. </purpose></data-member>
<method-group name="public member functions">
<constructor id="doxygen.classboost_1_1crc__optimal_1a6c378ca53a31264fba1afe360c5d95ca" specifiers="explicit"><parameter name="init_rem"><paramtype>value_type</paramtype><default>initial_remainder</default><description><para>The (unaugmented) initial state of the polynomial remainder. Defaults to <link linkend="doxygen.classboost_1_1crc__optimal_1a2497f9010a8b85f40365ced74dc664c4">initial_remainder</link> if omitted.</para></description></parameter><purpose>Create a computer, giving an initial remainder if desired. </purpose><description><para>Constructs a <computeroutput><link linkend="doxygen.classboost_1_1crc__optimal">crc_optimal</link></computeroutput> object with a particular CRC formula to be processed upon receiving input. The initial remainder may be overridden.</para><para>







</para></description><postconditions><para><computeroutput><link linkend="doxygen.classboost_1_1crc__optimal_1a2647a5458a3852af10275f20d2fe50a4">truncated_polynominal</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1af5ebc14ee4a4ff150b5a2dbe2f1fba3e">get_truncated_polynominal()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><link linkend="doxygen.classboost_1_1crc__optimal_1a2497f9010a8b85f40365ced74dc664c4">initial_remainder</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a77e0d9e0a97fa5f2e35da81a1bd40218">get_initial_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><link linkend="doxygen.classboost_1_1crc__optimal_1af970b528f3afc9e6c53715c5b3f7aa54">final_xor_value</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a4bcccdc7a58696d71d5ef084c30e65ac">get_final_xor_value()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><link linkend="doxygen.classboost_1_1crc__optimal_1a23cc18cd925388ba2e612a9366467dec">reflect_input</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b">get_reflect_input()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><link linkend="doxygen.classboost_1_1crc__optimal_1a81908654cb154ae10f8cfa5644daf16d">reflect_remainder</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74">get_reflect_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput><emphasis>init_rem</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput>(<link linkend="doxygen.classboost_1_1crc__optimal_1a81908654cb154ae10f8cfa5644daf16d">reflect_remainder</link> ? REFLECT(<emphasis>init_rem</emphasis>) : <emphasis>init_rem</emphasis>) ^ <link linkend="doxygen.classboost_1_1crc__optimal_1af970b528f3afc9e6c53715c5b3f7aa54">final_xor_value</link> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a53efc8a3b44fe5a19a97853ef92e4e64">checksum()</link></computeroutput> </para>
</postconditions></constructor>
<method id="doxygen.classboost_1_1crc__optimal_1af5ebc14ee4a4ff150b5a2dbe2f1fba3e" name="get_truncated_polynominal" cv="const"><type>value_type</type><purpose>Return the (truncated) polynomial divisor.    </purpose><description><para>Returns a representation of the polynomial divisor. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term. The omitted bit for x<superscript>(<link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>)</superscript> term is always 1.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>, the values of higher-placed bits should be ignored (even any for x<superscript>(<link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>)</superscript>) since they're unregulated.    </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__optimal_1a77e0d9e0a97fa5f2e35da81a1bd40218" name="get_initial_remainder" cv="const"><type>value_type</type><purpose>Return what the polynomial remainder was set to during construction.    </purpose><description><para>Returns a representation of the polynomial remainder before any input has been submitted. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated.    </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__optimal_1a4bcccdc7a58696d71d5ef084c30e65ac" name="get_final_xor_value" cv="const"><type>value_type</type><purpose>Return the XOR-mask used during output processing.    </purpose><description><para>Returns the mask to be used during creation of a checksum. The mask is used for an exclusive-or (XOR) operation applied bit-wise to the interim remainder representation (after any reflection, if <link linkend="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74">get_reflect_remainder()</link> returns <computeroutput>true</computeroutput>).</para><para>
</para></description><returns><para>The bit-mask. If the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated.    </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b" name="get_reflect_input" cv="const"><type>bool</type><purpose>Check if input-bytes will be reflected before processing.    </purpose><description><para>Returns whether or not a submitted byte will be "reflected" before it is used to update the interim remainder. Only the byte-wise operations <link linkend="doxygen.classboost_1_1crc__optimal_1a99edaaa138a0d07018ff2ac666be18c1">process_byte</link>, <link linkend="doxygen.classboost_1_1crc__optimal_1a3c8bb0cbcd481e266ef83afc09605244">process_block</link>, and <link linkend="doxygen.classboost_1_1crc__optimal_1a052a21f5cd1ae33780b072df893f9519">process_bytes</link> are affected.</para><para>
</para></description></method>
<method id="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74" name="get_reflect_remainder" cv="const"><type>bool</type><purpose>Check if the remainder will be reflected during output processing.    </purpose><description><para>Indicates if the interim remainder will be "reflected" before it is passed to the XOR-mask stage when returning a checksum.</para><para>
</para></description></method>
<method id="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698" name="get_interim_remainder" cv="const"><type>value_type</type><purpose>Return the remainder based from already-processed bits.    </purpose><description><para>Returns a representation of the polynomial remainder after all the input submissions since construction or the last <link linkend="doxygen.classboost_1_1crc__optimal_1a55ab397ac9de41044bb780f26b2525da">reset</link> call. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term. If CRC processing gets interrupted here, retain the value returned, and use it to start up the next CRC computer where you left off (with <link linkend="doxygen.classboost_1_1crc__optimal_1a55ab397ac9de41044bb780f26b2525da">reset(value_type)</link> or construction). The next computer has to have its other parameters compatible with this computer.</para><para>
</para></description><returns><para>The bit-packed list of coefficients. If the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>, the values of higher-placed bits should be ignored since they're unregulated. No output processing (reflection or XOR mask) has been applied to the value.    </para>
</returns></method>
<method id="doxygen.classboost_1_1crc__optimal_1a55ab397ac9de41044bb780f26b2525da" name="reset"><type>void</type><parameter name="new_rem"><paramtype>value_type</paramtype><default>initial_remainder</default><description><para>The (unaugmented) state of the polynomial remainder starting from this point, with no output processing applied. Defaults to <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a77e0d9e0a97fa5f2e35da81a1bd40218">get_initial_remainder()</link></computeroutput> if omitted.</para></description></parameter><purpose>Change the interim remainder to either a given value or the initial one. </purpose><description><para>Changes the interim polynomial remainder to <emphasis>new_rem</emphasis>, purging any influence previously submitted input has had. The value of the 2<superscript>i</superscript> bit is the value of the coefficient of the polynomial's x<superscript>i</superscript> term.</para><para>


</para></description><postconditions><para><computeroutput><emphasis>new_rem</emphasis> == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link></computeroutput> </para>
</postconditions><postconditions><para><computeroutput>((this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74">get_reflect_remainder()</link> ? REFLECT(<emphasis>new_rem</emphasis>) : <emphasis>new_rem</emphasis>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a4bcccdc7a58696d71d5ef084c30e65ac">get_final_xor_value()</link>) == this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a53efc8a3b44fe5a19a97853ef92e4e64">checksum()</link></computeroutput> </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__optimal_1a99edaaa138a0d07018ff2ac666be18c1" name="process_byte"><type>void</type><parameter name="byte"><paramtype>unsigned char</paramtype><description><para>The new input byte.</para></description></parameter><purpose>Submit a single byte for input processing.    </purpose><description><para>Updates the interim remainder with a byte's worth of altered-CRC-division steps. The bits within the byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise.</para><para>

<note><para>Any modulo-2 polynomial divisions may use a table of pre-computed remainder changes (as XOR masks) to speed computation when reading data byte-wise. </para>
</note>
</para></description><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT</computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs.   </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__optimal_1a3c8bb0cbcd481e266ef83afc09605244" name="process_block"><type>void</type><parameter name="bytes_begin"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="bytes_end"><paramtype>void const *</paramtype><description><para>Points to one-byte past the address of the memory block's last byte, or <emphasis>bytes_begin</emphasis> if no bytes are to be read.</para></description></parameter><purpose>Submit a memory block for input processing, iterator-pair style.    </purpose><description><para>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <emphasis>bytes_begin</emphasis> until <emphasis>bytes_end</emphasis> is reached through forward iteration, treating the two pointers as if they point to <computeroutput>unsigned char</computeroutput> objects.</para><para>




<note><para>Any modulo-2 polynomial divisions may use a table of pre-computed remainder changes (as XOR masks) to speed computation when reading data byte-wise. </para>
</note>
</para></description><requires><para><emphasis>bytes_end</emphasis> has to equal <emphasis>bytes_begin</emphasis> if the latter is <computeroutput>NULL</computeroutput> or otherwise doesn't point to a valid buffer. </para>
</requires><requires><para><emphasis>bytes_end</emphasis>, if not equal to <emphasis>bytes_begin</emphasis>, has to point within or one-byte-past the same buffer <emphasis>bytes_begin</emphasis> points into. </para>
</requires><requires><para><emphasis>bytes_end</emphasis> has to be reachable from <emphasis>bytes_begin</emphasis> through a finite number of forward byte-pointer increments.</para>
</requires><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT * (((unsigned char const *) bytes_end) - ((unsigned char const *) bytes_begin))</computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs.   </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__optimal_1a052a21f5cd1ae33780b072df893f9519" name="process_bytes"><type>void</type><parameter name="buffer"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="byte_count"><paramtype>std::size_t</paramtype><description><para>The number of bytes in the memory block.</para></description></parameter><purpose>Submit a memory block for input processing, pointer-and-size style.    </purpose><description><para>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <emphasis>buffer</emphasis>, forward-iterated (as if the pointed-to objects were of <computeroutput>unsigned char</computeroutput>) until <emphasis>byte_count</emphasis> bytes are read.</para><para>



<note><para>Any modulo-2 polynomial divisions may use a table of pre-computed remainder changes (as XOR masks) to speed computation when reading data byte-wise. </para>
</note>
</para></description><requires><para><emphasis>byte_count</emphasis> has to equal 0 if <emphasis>buffer</emphasis> is <computeroutput>NULL</computeroutput> or otherwise doesn't point to valid memory. </para>
</requires><requires><para>If <emphasis>buffer</emphasis> points within valid memory, then that block has to have at least <emphasis>byte_count</emphasis> more valid bytes allocated from that point.</para>
</requires><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT * <emphasis>byte_count</emphasis></computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs.   </para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__optimal_1a53efc8a3b44fe5a19a97853ef92e4e64" name="checksum" cv="const"><type>value_type</type><purpose>Return the checksum of the already-processed bits.    </purpose><description><para>Computes the checksum of all the submitted bits since construction or the last call to <link linkend="doxygen.classboost_1_1crc__optimal_1a55ab397ac9de41044bb780f26b2525da">reset</link>. The checksum will be the raw checksum, i.e. the (interim) remainder after all the modulo-2 polynomial division, plus any output processing.</para><para>
<note><para>Since checksums are meant to be compared, any higher-placed bits (when the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>) will be set to 0.    </para>
</note>
</para></description><returns><para><computeroutput>(this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74">get_reflect_remainder()</link> ? REFLECT(this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link>) : this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a4bcccdc7a58696d71d5ef084c30e65ac">get_final_xor_value()</link></computeroutput></para>
</returns></method>
<method id="doxygen.classboost_1_1crc__optimal_1a60652a197a5f1e413394be3878e12f35" name="operator()"><type>void</type><parameter name="byte"><paramtype>unsigned char</paramtype><description><para>The new input byte.</para></description></parameter><purpose>Submit a single byte for input processing, suitable for the STL. </purpose><description><para>Updates the interim remainder with a byte's worth of altered-CRC-division steps. The bits within the byte are processed from the highest place down if <computeroutput>this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1acb73aef87989da4a0f3d5d6f739e923b">get_reflect_input()</link></computeroutput> is <computeroutput>false</computeroutput>, and lowest place up otherwise. This function is meant to present a function-object interface to code that wants to process a stream of bytes with <computeroutput>std::for_each</computeroutput> or similar range-processing algorithms. Since some of these algorithms takes their function object by value, make sure to copy back the result to this object so the updates can be remembered.</para><para>

<note><para>Any modulo-2 polynomial divisions may use a table of pre-computed remainder changes (as XOR masks) to speed computation when reading data byte-wise. </para>
</note>
</para></description><postconditions><para>The interim remainder is updated through <computeroutput>CHAR_BIT</computeroutput> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs.</para>
</postconditions></method>
<method id="doxygen.classboost_1_1crc__optimal_1ab4eac91cf370584ab7de3c20d8bbabb8" name="operator()" cv="const"><type>value_type</type><purpose>Return the checksum of the already-processed bits, suitable for the STL. </purpose><description><para>Computes the checksum of all the submitted bits since construction or the last call to <link linkend="doxygen.classboost_1_1crc__optimal_1a55ab397ac9de41044bb780f26b2525da">reset</link>. The checksum will be the raw checksum, i.e. the (interim) remainder after all the modulo-2 polynomial division, plus any output processing. This function is meant to present a function-object interface to code that wants to receive data like <computeroutput>std::generate_n</computeroutput> or similar data-processing algorithms. Note that if this object is used as a generator multiple times without an intervening mutating operation, the same value will always be returned.</para><para>
<note><para>Since checksums are meant to be compared, any higher-placed bits (when the bit-length of <link linkend="doxygen.classboost_1_1crc__optimal_1a14f17ab5121146fe4d2134041f21953f">value_type</link> exceeds <link linkend="doxygen.classboost_1_1crc__optimal_1a4e0d41479acd8f70508ebbc0f7df8745">bit_count</link>) will be set to 0. </para>
</note>
</para></description><returns><para><computeroutput>(this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1ac11e98c973ff528443e3a8e152348f74">get_reflect_remainder()</link> ? REFLECT(this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link>) : this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a45251badb63e850e3ce8d4af6fc1e698">get_interim_remainder()</link>) ^ this-&gt;<link linkend="doxygen.classboost_1_1crc__optimal_1a4bcccdc7a58696d71d5ef084c30e65ac">get_final_xor_value()</link></computeroutput></para>
</returns></method>
</method-group>
</class><typedef id="doxygen.crc_8hpp_1abec40608728367a06f657edebd9f27d8" name="crc_16_type"><purpose>Computation type for ARC|CRC-16|CRC-IBM|CRC-16/ARC|CRC-16/LHA standard. </purpose><type><classname>crc_optimal</classname>&lt; 16, 0x8005, 0, 0, true, true &gt;</type></typedef>
<typedef id="doxygen.crc_8hpp_1ac911a271787633850c956f91fcbc2845" name="crc_ccitt_false_t"><purpose>Computation type for CRC-16/CCITT-FALSE standard. </purpose><type><classname>crc_optimal</classname>&lt; 16, 0x1021, 0xFFFF, 0, false, false &gt;</type></typedef>
<typedef id="doxygen.crc_8hpp_1a27cfff86c810ab61ae88ee41606f85b0" name="crc_ccitt_type"><purpose>Computation type for the CRC mistakenly called the CCITT standard. </purpose><type>crc_ccitt_false_t</type></typedef>
<typedef id="doxygen.crc_8hpp_1ac42566db9fbfefa92a02bd987182c7a1" name="crc_ccitt_true_t"><description><para>Computation type for the actual KERMIT|CRC-16/CCITT|CRC-16/CCITT-TRUE|CRC-CCITT standard </para></description><type><classname>crc_optimal</classname>&lt; 16, 0x1021, 0, 0, true, true &gt;</type></typedef>
<typedef id="doxygen.crc_8hpp_1a3e9550c8ab95d2cc66cf5becbdc74318" name="crc_xmodem_type"><description><para>Computation type that I mistakenly called the XMODEM standard; it inverts both reflection parameters and reflects the truncated divisor (Don't use?!) </para></description><type><classname>crc_optimal</classname>&lt; 16, 0x8408, 0, 0, true, true &gt;</type></typedef>
<typedef id="doxygen.crc_8hpp_1aca7e7d6abdfd75724602215a05c04ce0" name="crc_xmodem_t"><purpose>Computation type for the actual XMODEM|ZMODEM|CRC-16/ACORN standard. </purpose><type><classname>crc_optimal</classname>&lt; 16, 0x1021, 0, 0, false, false &gt;</type></typedef>
<typedef id="doxygen.crc_8hpp_1a303290b6fc440bb078d2295bfa5c0013" name="crc_32_type"><purpose>Computation type for CRC-32|CRC-32/ADCCP|PKZIP standard. </purpose><type><classname>crc_optimal</classname>&lt; 32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true &gt;</type></typedef>
<function id="doxygen.crc_8hpp_1a0856245a5a7e904eae05cc711bb51e48" name="crc"><type><emphasis>unspecified</emphasis></type><template>
          <template-nontype-parameter name="Bits"><type>std::size_t</type><purpose><para>The order of the modulo-2 polynomial divisor. (<emphasis>Width</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="TruncPoly"><type><emphasis>unspecified</emphasis></type><purpose><para>The lowest coefficients of the divisor polynomial. The highest-order coefficient is omitted and always assumed to be 1. (<emphasis>Poly</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="InitRem"><type><emphasis>unspecified</emphasis></type><purpose><para>The (unaugmented) initial state of the polynomial remainder. (<emphasis>Init</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="FinalXor"><type><emphasis>unspecified</emphasis></type><purpose><para>The (XOR) bit-mask to be applied to the output remainder, after possible reflection but before returning. (<emphasis>XorOut</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="ReflectIn"><type>bool</type><purpose><para>If <computeroutput>True</computeroutput>, input bytes are read lowest-order bit first, otherwise highest-order bit first. (<emphasis>RefIn</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="ReflectRem"><type>bool</type><purpose><para>If <computeroutput>True</computeroutput>, the output remainder is reflected before the XOR-mask. (<emphasis>RefOut</emphasis> from the RMCA)</para></purpose></template-nontype-parameter>
        </template><parameter name="buffer"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="byte_count"><paramtype>std::size_t</paramtype><description><para>The number of bytes in the memory block.</para></description></parameter><purpose>Compute the (unaugmented) CRC of a memory block. </purpose><description><para>Computes the polynomial remainder of a CRC run, assuming that <emphasis>buffer</emphasis> and <emphasis>byte_count</emphasis> describe a memory block representing the polynomial dividend. The division steps are altered so the result directly gives a checksum, without need to augment the memory block with scratch-space bytes. The first byte is considered the highest order, going down for subsequent bytes.</para><para>



<note><para>Unaugmented-style CRC runs perform modulo-2 polynomial division in an altered order. The trailing <emphasis>Bits</emphasis> number of zero-valued bits needed to extract an (unprocessed) checksum is virtually moved to near the beginning of the message. This is OK since the XOR operation is commutative and associative. It also means that you can get a checksum anytime. Since data is being read byte-wise, a table of pre-computed remainder changes (as XOR masks) can be used to speed computation. </para>
</note>
</para></description><requires><para>0 &lt; <emphasis>Bits</emphasis> &lt;= <computeroutput>std::numeric_limits&lt;uintmax_t&gt;::digits</computeroutput> </para>
</requires><returns><para>The checksum, which is the last (interim) remainder plus any output processing.</para>
</returns></function>
<function id="doxygen.crc_8hpp_1af3836264a8137a5950f37dabb48480b2" name="augmented_crc"><type><emphasis>unspecified</emphasis></type><template>
          <template-nontype-parameter name="Bits"><type>std::size_t</type><purpose><para>The order of the modulo-2 polynomial divisor. (<emphasis>Width</emphasis> from the RMCA) </para></purpose></template-nontype-parameter>
          <template-nontype-parameter name="TruncPoly"><type><emphasis>unspecified</emphasis></type><purpose><para>The lowest coefficients of the divisor polynomial. The highest-order coefficient is omitted and always assumed to be 1. (<emphasis>Poly</emphasis> from the RMCA)</para></purpose></template-nontype-parameter>
        </template><parameter name="buffer"><paramtype>void const *</paramtype><description><para>The address where the memory block begins. </para></description></parameter><parameter name="byte_count"><paramtype>std::size_t</paramtype><description><para>The number of bytes in the memory block. </para></description></parameter><parameter name="initial_remainder"><paramtype><emphasis>unspecified</emphasis></paramtype><default>0u</default><description><para>The initial state of the polynomial remainder, defaulting to zero if omitted. If you are reading a memory block in multiple runs, put the return value of the previous run here. (Note that initial-remainders given by RMCA parameter lists, as <emphasis>Init</emphasis>, assume that the initial remainder is in its <emphasis role="bold">unaugmented</emphasis> state, so you would need to convert the value to make it suitable for this function. I currently don't provide a conversion routine.)</para></description></parameter><purpose>Compute the CRC of a memory block, with any augmentation provided by user. </purpose><description><para>Computes the polynomial remainder of a CRC run, assuming that <emphasis>buffer</emphasis> and <emphasis>byte_count</emphasis> describe a memory block representing the polynomial dividend. The first byte is considered the highest order, going down for subsequent bytes. Within a byte, the highest-order bit is read first (corresponding to <emphasis>RefIn</emphasis> = <computeroutput>False</computeroutput> in the RMCA). Check the other parts of this function's documentation to see how a checksum can be gained and/or used.</para><para>



<note><para>Augmented-style CRC runs use straight-up modulo-2 polynomial division. Since data is being read byte-wise, a table of pre-computed remainder changes (as XOR masks) can be used to speed computation. </para>
</note>
<note><para>Reading just a memory block will yield an interim remainder, and not the final checksum. To get that checksum, allocate <emphasis>Bits</emphasis> / <computeroutput>CHAR_BIT</computeroutput> bytes directly after the block and fill them with zero values, then extend <emphasis>byte_count</emphasis> to include those extra bytes. A data block is corrupt if the return value doesn't equal your separately given checksum. </para>
</note>
<note><para>Another way to perform a check is use the zero-byte extension method, but replace the zero values with your separately-given checksum. The checksum must be loaded in big-endian order. Here corruption, in either the data block or the given checksum, is confirmed if the return value is not zero. </para>
</note>
<note><para>The two checksum techniques assume the CRC-run is performed bit-wise, while this function works byte-wise. That means that the techniques can be used only if <computeroutput>CHAR_BIT</computeroutput> divides <emphasis>Bits</emphasis> evenly! </para>
</note>
</para></description><requires><para>0 &lt; <emphasis>Bits</emphasis> &lt;= <computeroutput>std::numeric_limit&lt;uintmax_t&gt;::digits</computeroutput> </para>
</requires><returns><para>The interim remainder, if no augmentation is used. A special value if augmentation is used (see the notes). No output processing is done on the value. (In RMCA terms, <emphasis>RefOut</emphasis> is <computeroutput>False</computeroutput> and <emphasis>XorOut</emphasis> is <computeroutput>0</computeroutput>.)</para>
</returns></function>
</namespace>
<macro id="doxygen.crc_8hpp_1ae243d24ef0db8649dd19fcda871efce5" name="BOOST_CRC_PARM_TYPE"/>
<macro id="doxygen.crc_8hpp_1a58dea9d2adb0be7f756c36f157d70686" name="BOOST_CRC_OPTIMAL_NAME"/>
</header>
</library-reference>