\hypertarget{hash__string_8h}{\section{opal/include/opal/hash\+\_\+string.h File Reference}
\label{hash__string_8h}\index{opal/include/opal/hash\+\_\+string.\+h@{opal/include/opal/hash\+\_\+string.\+h}}
}


Simple macros to quickly compute a hash value from a string.  


\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{hash__string_8h_a5c0e7b8a6a04624ec7559f72269aa87f}{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N}(str, hash, length)
\begin{DoxyCompactList}\small\item\em Compute the hash value and the string length simultaneously. \end{DoxyCompactList}\item 
\#define \hyperlink{hash__string_8h_a810a9c542671e791b99008ac653c458f}{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R}(str, hash)
\begin{DoxyCompactList}\small\item\em Compute the hash value. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Simple macros to quickly compute a hash value from a string. 



\subsection{Macro Definition Documentation}
\hypertarget{hash__string_8h_a810a9c542671e791b99008ac653c458f}{\index{hash\+\_\+string.\+h@{hash\+\_\+string.\+h}!O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R@{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R}}
\index{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R@{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R}!hash\+\_\+string.\+h@{hash\+\_\+string.\+h}}
\subsubsection[{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R(
\begin{DoxyParamCaption}
\item[{}]{str, }
\item[{}]{hash}
\end{DoxyParamCaption}
)}}\label{hash__string_8h_a810a9c542671e791b99008ac653c458f}
{\bfseries Value\+:}
\begin{DoxyCode}
\textcolor{keywordflow}{do} \{                                      \(\backslash\)
        register \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\_str = (str);    \(\backslash\)
        register uint32\_t    \_hash = 0;       \(\backslash\)
                                              \(\backslash\)
        while( *\_str ) \{                      \(\backslash\)
            \_hash += *\_str++;                 \(\backslash\)
            \_hash += (\_hash << 10);           \(\backslash\)
            \_hash ^= (\_hash >> 6);            \(\backslash\)
        \}                                     \(\backslash\)
                                              \(\backslash\)
        \_hash += (\_hash << 3);                \(\backslash\)
        \_hash ^= (\_hash >> 11);               \(\backslash\)
        (hash) = (\_hash + (\_hash << 15));     \(\backslash\)
    \} \textcolor{keywordflow}{while}(0)
\end{DoxyCode}


Compute the hash value. 


\begin{DoxyParams}{Parameters}
{\em str} & (I\+N) The string which will be parsed (char$\ast$) \\
\hline
{\em hash} & (O\+U\+T) Where the hash value will be stored (uint32\+\_\+t) \\
\hline
\end{DoxyParams}
\hypertarget{hash__string_8h_a5c0e7b8a6a04624ec7559f72269aa87f}{\index{hash\+\_\+string.\+h@{hash\+\_\+string.\+h}!O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N@{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N}}
\index{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N@{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N}!hash\+\_\+string.\+h@{hash\+\_\+string.\+h}}
\subsubsection[{O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\+P\+A\+L\+\_\+\+H\+A\+S\+H\+\_\+\+S\+T\+R\+L\+E\+N(
\begin{DoxyParamCaption}
\item[{}]{str, }
\item[{}]{hash, }
\item[{}]{length}
\end{DoxyParamCaption}
)}}\label{hash__string_8h_a5c0e7b8a6a04624ec7559f72269aa87f}
{\bfseries Value\+:}
\begin{DoxyCode}
\textcolor{keywordflow}{do} \{                                      \(\backslash\)
        register \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\_str = (str);    \(\backslash\)
        register uint32\_t    \_hash = 0;       \(\backslash\)
        register uint32\_t    \_len = 0;        \(\backslash\)
                                              \(\backslash\)
        while( *\_str ) \{                      \(\backslash\)
            \_len++;                           \(\backslash\)
            \_hash += *\_str++;                 \(\backslash\)
            \_hash += (\_hash << 10);           \(\backslash\)
            \_hash ^= (\_hash >> 6);            \(\backslash\)
        \}                                     \(\backslash\)
                                              \(\backslash\)
        \_hash += (\_hash << 3);                \(\backslash\)
        \_hash ^= (\_hash >> 11);               \(\backslash\)
        (hash) = (\_hash + (\_hash << 15));     \(\backslash\)
        (length)  = \_len;                     \(\backslash\)
    \} \textcolor{keywordflow}{while}(0)
\end{DoxyCode}


Compute the hash value and the string length simultaneously. 


\begin{DoxyParams}{Parameters}
{\em str} & (I\+N) The string which will be parsed (char$\ast$) \\
\hline
{\em hash} & (O\+U\+T) Where the hash value will be stored (uint32\+\_\+t) \\
\hline
{\em length} & (O\+U\+T) The computed length of the string (uint32\+\_\+t) \\
\hline
\end{DoxyParams}
