\hypertarget{group__util__crc}{}\doxysubsection{$<$util/crc16.h$>$\+: C\+RC Computations}
\label{group__util__crc}\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \mbox{\hyperlink{group__util__crc_ga95371c87f25b0a2497d9cba13190847f}{\+\_\+crc16\+\_\+update}} (\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+\+\_\+crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+data)
\item 
static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \mbox{\hyperlink{group__util__crc_gaca726c22a1900f9bad52594c8846115f}{\+\_\+crc\+\_\+xmodem\+\_\+update}} (\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+\+\_\+crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+data)
\item 
static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \mbox{\hyperlink{group__util__crc_ga1c1d3ad875310cbc58000e24d981ad20}{\+\_\+crc\+\_\+ccitt\+\_\+update}} (\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+\+\_\+crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+data)
\item 
static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \mbox{\hyperlink{group__util__crc_ga37b2f691ebbd917e36e40b096f78d996}{\+\_\+crc\+\_\+ibutton\+\_\+update}} (\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+data)
\item 
static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \mbox{\hyperlink{group__util__crc_gab27eaaef6d7fd096bd7d57bf3f9ba083}{\+\_\+crc8\+\_\+ccitt\+\_\+update}} (\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+\+\_\+data)
\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{crc16_8h}{util/crc16.h}}>}}
\end{DoxyCode}


This header file provides a optimized inline functions for calculating cyclic redundancy checks (C\+RC) using common polynomials.

\begin{DoxyParagraph}{References\+:}

\end{DoxyParagraph}
\begin{DoxyParagraph}{}

\end{DoxyParagraph}
See the Dallas Semiconductor app note 27 for 8051 assembler example and general C\+RC optimization suggestions. The table on the last page of the app note is the key to understanding these implementations.

\begin{DoxyParagraph}{}

\end{DoxyParagraph}
Jack Crenshaw\textquotesingle{}s \char`\"{}\+Implementing C\+R\+Cs\char`\"{} article in the January 1992 isue of {\itshape Embedded} {\itshape Systems} {\itshape Programming}. This may be difficult to find, but it explains C\+RC\textquotesingle{}s in very clear and concise terms. Well worth the effort to obtain a copy.

A typical application would look like\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{// Dallas iButton test vector.}}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} serno[] = \{ 0x02, 0x1c, 0xb8, 0x01, 0, 0, 0, 0xa2 \};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{checkcrc(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} crc = 0, i;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{for} (i = 0; i < \textcolor{keyword}{sizeof} serno / \textcolor{keyword}{sizeof} serno[0]; i++)}
\DoxyCodeLine{    crc = \mbox{\hyperlink{group__util__crc_ga37b2f691ebbd917e36e40b096f78d996}{\_crc\_ibutton\_update}}(crc, serno[i]);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{return} crc; \textcolor{comment}{// must be 0}}
\DoxyCodeLine{\}}
\end{DoxyCode}
 

\doxysubsubsection{Function Documentation}
\mbox{\Hypertarget{group__util__crc_ga95371c87f25b0a2497d9cba13190847f}\label{group__util__crc_ga95371c87f25b0a2497d9cba13190847f}} 
\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}!\_crc16\_update@{\_crc16\_update}}
\index{\_crc16\_update@{\_crc16\_update}!$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxyparagraph{\texorpdfstring{\_crc16\_update()}{\_crc16\_update()}}
{\footnotesize\ttfamily static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+crc16\+\_\+update (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}}}]{\+\_\+\+\_\+crc,  }\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Optimized C\+R\+C-\/16 calculation.

Polynomial\+: x$^\wedge$16 + x$^\wedge$15 + x$^\wedge$2 + 1 (0xa001)~\newline
 Initial value\+: 0xffff

This C\+RC is normally used in disk-\/drive controllers.

The following is the equivalent functionality written in C.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}}}
\DoxyCodeLine{crc16\_update(\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}} crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} a)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\textcolor{keywordtype}{int} i;}
\DoxyCodeLine{}
\DoxyCodeLine{crc \string^= a;}
\DoxyCodeLine{\textcolor{keywordflow}{for} (i = 0; i < 8; ++i)}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \textcolor{keywordflow}{if} (crc \& 1)}
\DoxyCodeLine{    crc = (crc >> 1) \string^ 0xA001;}
\DoxyCodeLine{    \textcolor{keywordflow}{else}}
\DoxyCodeLine{    crc = (crc >> 1);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{return} crc;}
\DoxyCodeLine{\}}
\end{DoxyCode}
 \mbox{\Hypertarget{group__util__crc_gab27eaaef6d7fd096bd7d57bf3f9ba083}\label{group__util__crc_gab27eaaef6d7fd096bd7d57bf3f9ba083}} 
\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}!\_crc8\_ccitt\_update@{\_crc8\_ccitt\_update}}
\index{\_crc8\_ccitt\_update@{\_crc8\_ccitt\_update}!$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxyparagraph{\texorpdfstring{\_crc8\_ccitt\_update()}{\_crc8\_ccitt\_update()}}
{\footnotesize\ttfamily static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+crc8\+\_\+ccitt\+\_\+update (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+crc,  }\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Optimized C\+R\+C-\/8-\/\+C\+C\+I\+TT calculation.

Polynomial\+: x$^\wedge$8 + x$^\wedge$2 + x + 1 (0x\+E0)~\newline


For use with simple C\+R\+C-\/8~\newline
 Initial value\+: 0x0

For use with C\+R\+C-\/8-\/\+R\+O\+HC~\newline
 Initial value\+: 0xff~\newline
 Reference\+: \href{http://tools.ietf.org/html/rfc3095\#section-5.9.1}{\texttt{ http\+://tools.\+ietf.\+org/html/rfc3095\#section-\/5.\+9.\+1}}

For use with C\+R\+C-\/8-\/\+A\+T\+M/\+I\+TU~\newline
 Initial value\+: 0xff~\newline
 Final X\+OR value\+: 0x55~\newline
 Reference\+: \href{http://www.itu.int/rec/T-REC-I.432.1-199902-I/en}{\texttt{ http\+://www.\+itu.\+int/rec/\+T-\/\+R\+E\+C-\/\+I.\+432.\+1-\/199902-\/\+I/en}}

The C equivalent has been originally written by Dave Hylands. Assembly code is based on \+\_\+crc\+\_\+ibutton\+\_\+update optimization.

The following is the equivalent functionality written in C.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}}}
\DoxyCodeLine{\mbox{\hyperlink{group__util__crc_gab27eaaef6d7fd096bd7d57bf3f9ba083}{\_crc8\_ccitt\_update}} (\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} inCrc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} inData)}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}}   i;}
\DoxyCodeLine{    \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}}   data;}
\DoxyCodeLine{}
\DoxyCodeLine{    data = inCrc \string^ inData;}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{keywordflow}{for} ( i = 0; i < 8; i++ )}
\DoxyCodeLine{    \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (( data \& 0x80 ) != 0 )}
\DoxyCodeLine{        \{}
\DoxyCodeLine{            data <<= 1;}
\DoxyCodeLine{            data \string^= 0x07;}
\DoxyCodeLine{        \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{        \{}
\DoxyCodeLine{            data <<= 1;}
\DoxyCodeLine{        \}}
\DoxyCodeLine{    \}}
\DoxyCodeLine{    \textcolor{keywordflow}{return} data;}
\DoxyCodeLine{\}}
\end{DoxyCode}
 \mbox{\Hypertarget{group__util__crc_ga1c1d3ad875310cbc58000e24d981ad20}\label{group__util__crc_ga1c1d3ad875310cbc58000e24d981ad20}} 
\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}!\_crc\_ccitt\_update@{\_crc\_ccitt\_update}}
\index{\_crc\_ccitt\_update@{\_crc\_ccitt\_update}!$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxyparagraph{\texorpdfstring{\_crc\_ccitt\_update()}{\_crc\_ccitt\_update()}}
{\footnotesize\ttfamily static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+crc\+\_\+ccitt\+\_\+update (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}}}]{\+\_\+\+\_\+crc,  }\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Optimized C\+R\+C-\/\+C\+C\+I\+TT calculation.

Polynomial\+: x$^\wedge$16 + x$^\wedge$12 + x$^\wedge$5 + 1 (0x8408)~\newline
 Initial value\+: 0xffff

This is the C\+RC used by P\+PP and Ir\+DA.

See R\+F\+C1171 (P\+PP protocol) and Ir\+DA Ir\+L\+AP 1.\+1

\begin{DoxyNote}{Note}
Although the C\+C\+I\+TT polynomial is the same as that used by the Xmodem protocol, they are quite different. The difference is in how the bits are shifted through the alorgithm. Xmodem shifts the M\+SB of the C\+RC and the input first, while C\+C\+I\+TT shifts the L\+SB of the C\+RC and the input first.
\end{DoxyNote}
The following is the equivalent functionality written in C.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}}}
\DoxyCodeLine{crc\_ccitt\_update (\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}} crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{    data \string^= lo8 (crc);}
\DoxyCodeLine{    data \string^= data << 4;}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{keywordflow}{return} ((((\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}})data << 8) | hi8 (crc)) \string^ (\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}})(data >> 4) }
\DoxyCodeLine{            \string^ ((\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}})data << 3));}
\DoxyCodeLine{\}}
\end{DoxyCode}
 \mbox{\Hypertarget{group__util__crc_ga37b2f691ebbd917e36e40b096f78d996}\label{group__util__crc_ga37b2f691ebbd917e36e40b096f78d996}} 
\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}!\_crc\_ibutton\_update@{\_crc\_ibutton\_update}}
\index{\_crc\_ibutton\_update@{\_crc\_ibutton\_update}!$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxyparagraph{\texorpdfstring{\_crc\_ibutton\_update()}{\_crc\_ibutton\_update()}}
{\footnotesize\ttfamily static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}} \+\_\+crc\+\_\+ibutton\+\_\+update (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+crc,  }\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Optimized Dallas (now Maxim) i\+Button 8-\/bit C\+RC calculation.

Polynomial\+: x$^\wedge$8 + x$^\wedge$5 + x$^\wedge$4 + 1 (0x8C)~\newline
 Initial value\+: 0x0

See \href{http://www.maxim-ic.com/appnotes.cfm/appnote_number/27}{\texttt{ http\+://www.\+maxim-\/ic.\+com/appnotes.\+cfm/appnote\+\_\+number/27}}

The following is the equivalent functionality written in C.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}}}
\DoxyCodeLine{\mbox{\hyperlink{group__util__crc_ga37b2f691ebbd917e36e40b096f78d996}{\_crc\_ibutton\_update}}(\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} i;}
\DoxyCodeLine{}
\DoxyCodeLine{crc = crc \string^ data;}
\DoxyCodeLine{\textcolor{keywordflow}{for} (i = 0; i < 8; i++)}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \textcolor{keywordflow}{if} (crc \& 0x01)}
\DoxyCodeLine{        crc = (crc >> 1) \string^ 0x8C;}
\DoxyCodeLine{    \textcolor{keywordflow}{else}}
\DoxyCodeLine{        crc >>= 1;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{return} crc;}
\DoxyCodeLine{\}}
\end{DoxyCode}
 \mbox{\Hypertarget{group__util__crc_gaca726c22a1900f9bad52594c8846115f}\label{group__util__crc_gaca726c22a1900f9bad52594c8846115f}} 
\index{$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}!\_crc\_xmodem\_update@{\_crc\_xmodem\_update}}
\index{\_crc\_xmodem\_update@{\_crc\_xmodem\_update}!$<$util/crc16.h$>$: CRC Computations@{$<$util/crc16.h$>$: CRC Computations}}
\doxyparagraph{\texorpdfstring{\_crc\_xmodem\_update()}{\_crc\_xmodem\_update()}}
{\footnotesize\ttfamily static \+\_\+\+\_\+inline\+\_\+\+\_\+ \mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}} \+\_\+crc\+\_\+xmodem\+\_\+update (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\+\_\+t}}}]{\+\_\+\+\_\+crc,  }\item[{\mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\+\_\+t}}}]{\+\_\+\+\_\+data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Optimized C\+R\+C-\/\+X\+M\+O\+D\+EM calculation.

Polynomial\+: x$^\wedge$16 + x$^\wedge$12 + x$^\wedge$5 + 1 (0x1021)~\newline
 Initial value\+: 0x0

This is the C\+RC used by the Xmodem-\/\+C\+RC protocol.

The following is the equivalent functionality written in C.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}}}
\DoxyCodeLine{crc\_xmodem\_update (\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}} crc, \mbox{\hyperlink{group__avr__stdint_gaba7bc1797add20fe3efdf37ced1182c5}{uint8\_t}} data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{}
\DoxyCodeLine{    crc = crc \string^ ((\mbox{\hyperlink{group__avr__stdint_ga1f1825b69244eb3ad2c7165ddc99c956}{uint16\_t}})data << 8);}
\DoxyCodeLine{    \textcolor{keywordflow}{for} (i=0; i<8; i++)}
\DoxyCodeLine{    \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (crc \& 0x8000)}
\DoxyCodeLine{            crc = (crc << 1) \string^ 0x1021;}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{            crc <<= 1;}
\DoxyCodeLine{    \}}
\DoxyCodeLine{}
\DoxyCodeLine{    \textcolor{keywordflow}{return} crc;}
\DoxyCodeLine{\}}
\end{DoxyCode}
 