\hypertarget{BSWP_8h}{
\section{BSWP.h File Reference}
\label{BSWP_8h}\index{BSWP.h@{BSWP.h}}
}
Byteswapping, function prototypes, callable versions.  


\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{BSWP_8h_cbe6c8cfe1150144ab57775ef285eb0b}{BSWP\_\-swap16N} (unsigned short int $\ast$dst, const unsigned short int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 16 bit words. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_012b0b8d25ee9615781d3460cb6347b7}{BSWP\_\-swap16lN} (unsigned short int $\ast$dst, const unsigned short int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 16 bit words; local representation $<$=$>$ little. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_ed2488b0373438713d7b2e4356e30ab8}{BSWP\_\-swap16bN} (unsigned short int $\ast$dst, const unsigned short int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 16 bit words; local representation $<$=$>$ big. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_2c5e2dddf6fc382ba5a0bf66a02d3154}{BSWP\_\-swap32N} (unsigned int $\ast$dst, const unsigned int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 32 bit words. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_a4f770dfacbbf03f08d96ee08fa8fc1b}{BSWP\_\-swap32lN} (unsigned int $\ast$dst, const unsigned int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps an array 32 bit words; local representation $<$=$>$ little. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_c50562e377a898848916e91420d2100f}{BSWP\_\-swap32bN} (unsigned int $\ast$dst, const unsigned int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 32 bit words; local representation $<$=$>$ big. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_de9cf39e6f8cb78db06351df964b8ab2}{BSWP\_\-swap64N} (unsigned long long int $\ast$dst, const unsigned long long int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 64 bit words. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_4159224c448897a06f15917f3c7e27c4}{BSWP\_\-swap64lN} (unsigned long long int $\ast$dst, const unsigned long long int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps an array 64 bit words; local representation $<$=$>$ little. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_202aea6791ab3e82a8f442f330e5dfb8}{BSWP\_\-swap64bN} (unsigned long long int $\ast$dst, const unsigned long long int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 64 bit words; local representation $<$=$>$ big. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_930d28f79b4560b11be77e0844923a26}{BSWP\_\-swap16\_\-lclXlittleN} (unsigned short int $\ast$dst, const unsigned short int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 16 bit words; local representation $<$=$>$ little. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_60436671cbd75a7754acd50252509e46}{BSWP\_\-swap16\_\-lclXbigN} (unsigned short int $\ast$dst, const unsigned short int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 16 bit words; local representation $<$=$>$ big. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_858e95f9130bbecb1547c79f64720d14}{BSWP\_\-swap32\_\-lclXlittleN} (unsigned int $\ast$dst, const unsigned int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps an array 32 bit words; local representation $<$=$>$ little. \item\end{CompactList}\item 
void \hyperlink{BSWP_8h_548f66d103eb1abb117f402eb3a22520}{BSWP\_\-swap32\_\-lclXbigN} (unsigned int $\ast$dst, const unsigned int $\ast$src, int cnt)
\begin{CompactList}\small\item\em Byte swaps 32 bit words; local representation $<$=$>$ big. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Byteswapping, function prototypes, callable versions. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

    CVS $Id: BSWP.h,v 1.1.1.1 2006/02/10 21:45:35 saxton Exp $
\end{verbatim}
\normalsize


{\bf SYNOPSIS} \par
 The BSWP routines provide efficient and uniform methods of performing various byte swap operations on arrays of 16, 32 and 64 bit integers. These routines use the inline routines of \hyperlink{BSWP_8ih}{BSWP.ih} to implement the byteswapping. When possible (currently the PPC platforms), these inline routines map directly onto the hardware instructions used to load and store the 16, 32 and 64 bit byteswapped quantities to and from memory.

The routines come in 3 sets of 3. The first dimension is for operating on one of 16, 32 or 64 bit quantities, while the {\em 3\/} dimension is for operating on these quantities when they are

\begin{itemize}
\item unconditionally byteswapped\item translating to/from the local representation from/to big endian\item translating to/from the local representation from/to little endian\end{itemize}


The single word word swapping routines are so simple and efficiency is such a motivating design factor that these single word versions of the byteswapping routines are provided only as inlines; see \hyperlink{BSWP_8ih}{BSWP.ih} The vector routines are provided only as callable functions.

\begin{Desc}
\item[Note:]The vector swapping routines are safe independent of whether or how the source and destination buffers overlap. \end{Desc}


\subsection{Function Documentation}
\hypertarget{BSWP_8h_60436671cbd75a7754acd50252509e46}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap16\_\-lclXbigN@{BSWP\_\-swap16\_\-lclXbigN}}
\index{BSWP\_\-swap16\_\-lclXbigN@{BSWP\_\-swap16\_\-lclXbigN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap16\_\-lclXbigN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap16\_\-lclXbigN (unsigned short int $\ast$ {\em dst}, \/  const unsigned short int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_60436671cbd75a7754acd50252509e46}


Byte swaps 16 bit words; local representation $<$=$>$ big. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 16 bit words to swap \item[{\em cnt}]The number of 16 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 16 bit integer to/from local/big endian representation from to/big endian/local representation. If the local representation is big endian, then this operation is a copy. If the local representation is big endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_ed2488b0373438713d7b2e4356e30ab8}{BSWP\_\-swap16bN()}. \end{Desc}
\hypertarget{BSWP_8h_930d28f79b4560b11be77e0844923a26}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap16\_\-lclXlittleN@{BSWP\_\-swap16\_\-lclXlittleN}}
\index{BSWP\_\-swap16\_\-lclXlittleN@{BSWP\_\-swap16\_\-lclXlittleN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap16\_\-lclXlittleN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap16\_\-lclXlittleN (unsigned short int $\ast$ {\em dst}, \/  const unsigned short int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_930d28f79b4560b11be77e0844923a26}


Byte swaps 16 bit words; local representation $<$=$>$ little. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source array of 16 bit words to swap \item[{\em dst}]The destination array to receive the swapped words \item[{\em cnt}]The number of 16 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 16 bit integer to/from local/little endian representation from/to little endian/local representation. If the local representation is little endian, then this operation is a copy. If the local representation is little endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_012b0b8d25ee9615781d3460cb6347b7}{BSWP\_\-swap16lN()}. \end{Desc}
\hypertarget{BSWP_8h_ed2488b0373438713d7b2e4356e30ab8}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap16bN@{BSWP\_\-swap16bN}}
\index{BSWP\_\-swap16bN@{BSWP\_\-swap16bN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap16bN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap16bN (unsigned short int $\ast$ {\em dst}, \/  const unsigned short int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_ed2488b0373438713d7b2e4356e30ab8}


Byte swaps 16 bit words; local representation $<$=$>$ big. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 16 bit words to swap \item[{\em cnt}]The number of 16 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 16 bit integer to/from local/big endian representation from to/big endian/local representation. If the local representation is big endian, then this operation is a copy. If the local representation is big endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_ed2488b0373438713d7b2e4356e30ab8}{BSWP\_\-swap16bN()}. \end{Desc}
\hypertarget{BSWP_8h_012b0b8d25ee9615781d3460cb6347b7}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap16lN@{BSWP\_\-swap16lN}}
\index{BSWP\_\-swap16lN@{BSWP\_\-swap16lN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap16lN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap16lN (unsigned short int $\ast$ {\em dst}, \/  const unsigned short int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_012b0b8d25ee9615781d3460cb6347b7}


Byte swaps 16 bit words; local representation $<$=$>$ little. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source array of 16 bit words to swap \item[{\em dst}]The destination array to receive the swapped words \item[{\em cnt}]The number of 16 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 16 bit integer to/from local/little endian representation from/to little endian/local representation. If the local representation is little endian, then this operation is a copy. If the local representation is little endian and the source and destination addresses are identical, then this operation is a NOOP. \hypertarget{BSWP_8h_cbe6c8cfe1150144ab57775ef285eb0b}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap16N@{BSWP\_\-swap16N}}
\index{BSWP\_\-swap16N@{BSWP\_\-swap16N}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap16N}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap16N (unsigned short int $\ast$ {\em dst}, \/  const unsigned short int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_cbe6c8cfe1150144ab57775ef285eb0b}


Byte swaps 16 bit words. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 16 bit words to swap \item[{\em cnt}]The number of 16 bit words to swap\end{description}
\end{Desc}
This routine byte swaps the source array of 16 bit integers into the destination array. 

References BSWP\_\-\_\-load16x().\hypertarget{BSWP_8h_548f66d103eb1abb117f402eb3a22520}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap32\_\-lclXbigN@{BSWP\_\-swap32\_\-lclXbigN}}
\index{BSWP\_\-swap32\_\-lclXbigN@{BSWP\_\-swap32\_\-lclXbigN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap32\_\-lclXbigN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap32\_\-lclXbigN (unsigned int $\ast$ {\em dst}, \/  const unsigned int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_548f66d103eb1abb117f402eb3a22520}


Byte swaps 32 bit words; local representation $<$=$>$ big. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 32 bit words to swap \item[{\em cnt}]The number of 32 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 32 bit integer to/from local/big endian representation from/to big endian/local representation. If the local representation is big endian, then this operation is a copy. If the local representation is big endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_c50562e377a898848916e91420d2100f}{BSWP\_\-swap32bN()}. \end{Desc}
\hypertarget{BSWP_8h_858e95f9130bbecb1547c79f64720d14}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap32\_\-lclXlittleN@{BSWP\_\-swap32\_\-lclXlittleN}}
\index{BSWP\_\-swap32\_\-lclXlittleN@{BSWP\_\-swap32\_\-lclXlittleN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap32\_\-lclXlittleN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap32\_\-lclXlittleN (unsigned int $\ast$ {\em dst}, \/  const unsigned int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_858e95f9130bbecb1547c79f64720d14}


Byte swaps an array 32 bit words; local representation $<$=$>$ little. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 32 bit words to swap \item[{\em cnt}]The number of 32 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 32 bit integer to/from local/little endian representation from to little endian/local representation. If the local representation is little endian, then this operation is a copy. If the local representation is little endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_a4f770dfacbbf03f08d96ee08fa8fc1b}{BSWP\_\-swap32lN()}. \end{Desc}
\hypertarget{BSWP_8h_c50562e377a898848916e91420d2100f}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap32bN@{BSWP\_\-swap32bN}}
\index{BSWP\_\-swap32bN@{BSWP\_\-swap32bN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap32bN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap32bN (unsigned int $\ast$ {\em dst}, \/  const unsigned int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_c50562e377a898848916e91420d2100f}


Byte swaps 32 bit words; local representation $<$=$>$ big. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 32 bit words to swap \item[{\em cnt}]The number of 32 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 32 bit integer to/from local/big endian representation from/to big endian/local representation. If the local representation is big endian, then this operation is a copy. If the local representation is big endian and the source and destination addresses are identical, then this operation is a NOOP.

\begin{Desc}
\item[Warning:]This function name is being deprecated. The new name is \hyperlink{BSWP_8h_c50562e377a898848916e91420d2100f}{BSWP\_\-swap32bN()}. \end{Desc}
\hypertarget{BSWP_8h_a4f770dfacbbf03f08d96ee08fa8fc1b}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap32lN@{BSWP\_\-swap32lN}}
\index{BSWP\_\-swap32lN@{BSWP\_\-swap32lN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap32lN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap32lN (unsigned int $\ast$ {\em dst}, \/  const unsigned int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_a4f770dfacbbf03f08d96ee08fa8fc1b}


Byte swaps an array 32 bit words; local representation $<$=$>$ little. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 32 bit words to swap \item[{\em cnt}]The number of 32 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 32 bit integer to/from local/little endian representation from to little endian/local representation. If the local representation is little endian, then this operation is a copy. If the local representation is little endian and the source and destination addresses are identical, then this operation is a NOOP. \hypertarget{BSWP_8h_2c5e2dddf6fc382ba5a0bf66a02d3154}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap32N@{BSWP\_\-swap32N}}
\index{BSWP\_\-swap32N@{BSWP\_\-swap32N}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap32N}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap32N (unsigned int $\ast$ {\em dst}, \/  const unsigned int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_2c5e2dddf6fc382ba5a0bf66a02d3154}


Byte swaps 32 bit words. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source array of 32 bit words to swap \item[{\em dst}]The destination array to receive the swapped words \item[{\em cnt}]The number of 32 bit words to swap\end{description}
\end{Desc}
This routine byte swaps the source array of 32 bit integers into the destination array. 

References BSWP\_\-\_\-load32x().\hypertarget{BSWP_8h_202aea6791ab3e82a8f442f330e5dfb8}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap64bN@{BSWP\_\-swap64bN}}
\index{BSWP\_\-swap64bN@{BSWP\_\-swap64bN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap64bN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap64bN (unsigned long long int $\ast$ {\em dst}, \/  const unsigned long long int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_202aea6791ab3e82a8f442f330e5dfb8}


Byte swaps 64 bit words; local representation $<$=$>$ big. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 64 bit words to swap \item[{\em cnt}]The number of 64 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 64 bit integer to/from local/big endian representation from/to big endian/local representation. If the local representation is big endian, then this operation is a copy. If the local representation is big endian and the source and destination addresses are identical, then this operation is a NOOP. \hypertarget{BSWP_8h_4159224c448897a06f15917f3c7e27c4}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap64lN@{BSWP\_\-swap64lN}}
\index{BSWP\_\-swap64lN@{BSWP\_\-swap64lN}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap64lN}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap64lN (unsigned long long int $\ast$ {\em dst}, \/  const unsigned long long int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_4159224c448897a06f15917f3c7e27c4}


Byte swaps an array 64 bit words; local representation $<$=$>$ little. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dst}]The destination array to receive the swapped words \item[{\em src}]The source array of 64 bit words to swap \item[{\em cnt}]The number of 64 bit words to swap\end{description}
\end{Desc}
This routine transforms the source array of 64 bit integer to/from local/little endian representation from to little endian/local representation. If the local representation is little endian, then this operation is a copy. If the local representation is little endian and the source and destination addresses are identical, then this operation is a NOOP. \hypertarget{BSWP_8h_de9cf39e6f8cb78db06351df964b8ab2}{
\index{BSWP.h@{BSWP.h}!BSWP\_\-swap64N@{BSWP\_\-swap64N}}
\index{BSWP\_\-swap64N@{BSWP\_\-swap64N}!BSWP.h@{BSWP.h}}
\subsubsection[{BSWP\_\-swap64N}]{\setlength{\rightskip}{0pt plus 5cm}void BSWP\_\-swap64N (unsigned long long int $\ast$ {\em dst}, \/  const unsigned long long int $\ast$ {\em src}, \/  int {\em cnt})}}
\label{BSWP_8h_de9cf39e6f8cb78db06351df964b8ab2}


Byte swaps 64 bit words. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]The source array of 64 bit words to swap \item[{\em dst}]The destination array to receive the swapped words \item[{\em cnt}]The number of 64 bit words to swap\end{description}
\end{Desc}
This routine byte swaps the source array of 64 bit integers into the destination array. 

References BSWP\_\-\_\-load64x().