\hypertarget{BFP_8h}{
\section{BFP.h File Reference}
\label{BFP_8h}\index{BFP.h@{BFP.h}}
}
Bit Field Pack Routines. 



This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=110pt]{BFP_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a0}{BFP\_\-mask\-L} (int width)
\begin{CompactList}\small\item\em Produce a left justified mask of the specified width. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a1}{BFP\_\-mask\-R} (int width)
\begin{CompactList}\small\item\em Produce a right justified mask of the specified width. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a2}{BFP\_\-word\-L} (unsigned int $\ast$w, unsigned int position, unsigned int field, unsigned int width)
\begin{CompactList}\small\item\em Packs a left justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a3}{BFP\_\-word\-R} (unsigned int $\ast$w, unsigned int position, unsigned int field, unsigned int width)
\begin{CompactList}\small\item\em Packs a right justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a4}{BFP\_\-word\-LP} (unsigned int $\ast$w, unsigned int position, unsigned int field, unsigned int width)
\begin{CompactList}\small\item\em Packs a left justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a5}{BFP\_\-word\-RP} (unsigned int $\ast$w, unsigned int position, unsigned int field, unsigned int width)
\begin{CompactList}\small\item\em Packs a right justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits. \item\end{CompactList}\item 
static \_\-\_\-inline unsigned int \hyperlink{BFP_8h_a6}{BFP\_\-word\-B} (unsigned int $\ast$w, unsigned int position, unsigned int bit)
\begin{CompactList}\small\item\em Packs the value of the bit into the current bit position. The value of the bit is either 0 or 1, or said in a negative fashion, it is not the left justified version, {\em i.e\/}. 0x80000000 or 0. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Bit Field Pack Routines. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}
\begin{Desc}
\item[]Inline functions to (left justified) pack bit fields into a 32-bit output vector. These routines assume that any bits ahead of the current bit position index can be overwritten. In this sense these routines are not equivalent to a bit field insert routine which only write the bits in the designated bit field.\end{Desc}
\begin{Desc}
\item[]The routines come in a 2 x 2 set. One can insert a field of a specified width that is either left or right justified. In addition one can use unprotected or protected routines, the distinction being that the unprotected routines are faster, but demand that the user guarantee that no more than the specified bits are non-zero. Conversely, the protected routines limit the bit field to the specified width.\end{Desc}


\subsection{Function Documentation}
\hypertarget{BFP_8h_a0}{
\index{BFP.h@{BFP.h}!BFP_maskL@{BFP\_\-maskL}}
\index{BFP_maskL@{BFP\_\-maskL}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-maskL]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-mask\-L (int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a0}


Produce a left justified mask of the specified width. 

\begin{Desc}
\item[Returns:]A left justified mask of the specified width\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em width}]The width of the mask\end{description}
\end{Desc}
\begin{Desc}
\item[]The BFP\_\-word packing routines do not protect themselves against stray bits ({\em i.e\/}. bits set outside the specified width) for efficiency reasons. On most occasions this protection occurs naturally as part of composing the field, so this would be a waste of time. However, when it is needed this inline provides a tidy way to produce the necessary mask.\end{Desc}
\hypertarget{BFP_8h_a1}{
\index{BFP.h@{BFP.h}!BFP_maskR@{BFP\_\-maskR}}
\index{BFP_maskR@{BFP\_\-maskR}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-maskR]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-mask\-R (int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a1}


Produce a right justified mask of the specified width. 

\begin{Desc}
\item[Returns:]A right justified mask of the specified width\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em width}]The width of the mask, must be between 0 and 31.\end{description}
\end{Desc}
\begin{Desc}
\item[]The BFP\_\-word packing routines do not protect themselves against stray bits ({\em i.e\/}. bits set outside the specified width) for efficiency reasons. On most occasions this protection occurs naturally as part of composing the field, so this would be a waste of time. However, when it is needed this inline provides a tidy way to produce the necessary mask.\end{Desc}
\hypertarget{BFP_8h_a6}{
\index{BFP.h@{BFP.h}!BFP_wordB@{BFP\_\-wordB}}
\index{BFP_wordB@{BFP\_\-wordB}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-wordB]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-word\-B (unsigned int $\ast$ {\em w}, unsigned int {\em position}, unsigned int {\em bit})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a6}


Packs the value of the bit into the current bit position. The value of the bit is either 0 or 1, or said in a negative fashion, it is not the left justified version, {\em i.e\/}. 0x80000000 or 0. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The output word \item[{\em position}]The current bit position \item[{\em bit}]The value of the bit to insert (0 or 1) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The updated bit position\end{Desc}
\hypertarget{BFP_8h_a2}{
\index{BFP.h@{BFP.h}!BFP_wordL@{BFP\_\-wordL}}
\index{BFP_wordL@{BFP\_\-wordL}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-wordL]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-word\-L (unsigned int $\ast$ {\em w}, unsigned int {\em position}, unsigned int {\em field}, unsigned int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a2}


Packs a left justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The output word array to insert the bit field into \item[{\em position}]The current bit position in the output bit field \item[{\em field}]The left justified field to insert \item[{\em width}]The width of the field to insert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The new bit position (essentially position + width).\end{Desc}
\hypertarget{BFP_8h_a4}{
\index{BFP.h@{BFP.h}!BFP_wordLP@{BFP\_\-wordLP}}
\index{BFP_wordLP@{BFP\_\-wordLP}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-wordLP]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-word\-LP (unsigned int $\ast$ {\em w}, unsigned int {\em position}, unsigned int {\em field}, unsigned int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a4}


Packs a left justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The output word array to insert the bit field into \item[{\em position}]The current bit position in the output bit field \item[{\em field}]The left justified field to insert \item[{\em width}]The width of the field to insert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The new bit position (essentially position + width).\end{Desc}
\hypertarget{BFP_8h_a3}{
\index{BFP.h@{BFP.h}!BFP_wordR@{BFP\_\-wordR}}
\index{BFP_wordR@{BFP\_\-wordR}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-wordR]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-word\-R (unsigned int $\ast$ {\em w}, unsigned int {\em position}, unsigned int {\em field}, unsigned int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a3}


Packs a right justified bit field into the current position. The width of the bit field must be less than or equal to 32 bits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The output word array to insert the bit field into \item[{\em position}]The current bit position in the output bit field \item[{\em field}]The left justified field to insert \item[{\em width}]The width of the field to insert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The new bit position (essentially position + width).\end{Desc}
\hypertarget{BFP_8h_a5}{
\index{BFP.h@{BFP.h}!BFP_wordRP@{BFP\_\-wordRP}}
\index{BFP_wordRP@{BFP\_\-wordRP}!BFP.h@{BFP.h}}
\subsubsection[BFP\_\-wordRP]{\setlength{\rightskip}{0pt plus 5cm}static \_\-\_\-inline unsigned int BFP\_\-word\-RP (unsigned int $\ast$ {\em w}, unsigned int {\em position}, unsigned int {\em field}, unsigned int {\em width})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFP_8h_a5}


Packs a right justified bit field into the current position limiting the field to the specified width. The width of the bit field must be less than or equal to 32 bits. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em w}]The output word array to insert the bit field into \item[{\em position}]The current bit position in the output bit field \item[{\em field}]The right justified field to insert \item[{\em width}]The width of the field to insert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The new bit position (essentially position + width).\end{Desc}
