\hypertarget{group___mmal_rational_utilities}{}\section{Rational Utility Functions}
\label{group___mmal_rational_utilities}\index{Rational Utility Functions@{Rational Utility Functions}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} \hyperlink{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}{mmal\+\_\+rational\+\_\+add} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} a, \hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} b)
\item 
\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} \hyperlink{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}{mmal\+\_\+rational\+\_\+subtract} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} a, \hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} b)
\item 
\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} \hyperlink{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}{mmal\+\_\+rational\+\_\+multiply} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} a, \hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} b)
\item 
\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} \hyperlink{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}{mmal\+\_\+rational\+\_\+divide} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} a, \hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} b)
\item 
int32\+\_\+t \hyperlink{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} rational)
\item 
\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} \hyperlink{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16} (int32\+\_\+t fixed)
\item 
void \hyperlink{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}{mmal\+\_\+rational\+\_\+simplify} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} $\ast$rational)
\item 
M\+M\+A\+L\+\_\+\+B\+O\+O\+L\+\_\+\+T \hyperlink{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}{mmal\+\_\+rational\+\_\+equal} (\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} a, \hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} b)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
The rational utility functions allow easy manipulation of rational numbers. 

\subsection{Function Documentation}
\hypertarget{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+add@{mmal\+\_\+rational\+\_\+add}}
\index{mmal\+\_\+rational\+\_\+add@{mmal\+\_\+rational\+\_\+add}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} mmal\+\_\+rational\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{a, }
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{b}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}
Add 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a + b 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+divide@{mmal\+\_\+rational\+\_\+divide}}
\index{mmal\+\_\+rational\+\_\+divide@{mmal\+\_\+rational\+\_\+divide}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+divide}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} mmal\+\_\+rational\+\_\+divide (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{a, }
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{b}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}
Divide 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a / b 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+equal@{mmal\+\_\+rational\+\_\+equal}}
\index{mmal\+\_\+rational\+\_\+equal@{mmal\+\_\+rational\+\_\+equal}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+equal}]{\setlength{\rightskip}{0pt plus 5cm}M\+M\+A\+L\+\_\+\+B\+O\+O\+L\+\_\+\+T mmal\+\_\+rational\+\_\+equal (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{a, }
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{b}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}
Test 2 rational numbers for equality.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if equal 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}}
\index{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16 (
\begin{DoxyParamCaption}
\item[{int32\+\_\+t}]{fixed}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}
Convert a signed 32-\/bit Q16 number to a rational number.


\begin{DoxyParams}{Parameters}
{\em fixed} & Signed 32-\/bit Q16 number to convert\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Rational number 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+multiply@{mmal\+\_\+rational\+\_\+multiply}}
\index{mmal\+\_\+rational\+\_\+multiply@{mmal\+\_\+rational\+\_\+multiply}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+multiply}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} mmal\+\_\+rational\+\_\+multiply (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{a, }
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{b}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}
Multiply 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a $\ast$ b 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+simplify@{mmal\+\_\+rational\+\_\+simplify}}
\index{mmal\+\_\+rational\+\_\+simplify@{mmal\+\_\+rational\+\_\+simplify}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+simplify}]{\setlength{\rightskip}{0pt plus 5cm}void mmal\+\_\+rational\+\_\+simplify (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} $\ast$}]{rational}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}
Reduce a rational number to it\textquotesingle{}s simplest form.


\begin{DoxyParams}{Parameters}
{\em rational} & Rational number to simplify \\
\hline
\end{DoxyParams}
\hypertarget{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+subtract@{mmal\+\_\+rational\+\_\+subtract}}
\index{mmal\+\_\+rational\+\_\+subtract@{mmal\+\_\+rational\+\_\+subtract}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+subtract}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T} mmal\+\_\+rational\+\_\+subtract (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{a, }
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{b}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}
Subtract 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a -\/ b 
\end{DoxyReturn}
\hypertarget{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}{}\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}}
\index{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection[{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}]{\setlength{\rightskip}{0pt plus 5cm}int32\+\_\+t mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16 (
\begin{DoxyParamCaption}
\item[{{\bf M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+\+T}}]{rational}
\end{DoxyParamCaption}
)}\label{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}
Convert a rational number to a 32-\/bit signed Q16 number. Saturation will occur for rational numbers with an absolute value greater than 32768.


\begin{DoxyParams}{Parameters}
{\em rational} & Rational number to convert\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
32-\/bit signed Q16 number 
\end{DoxyReturn}
