\hypertarget{a00851_source}{}\doxysection{AAX\+\_\+\+Misc\+Utils.\+h}
\label{a00851_source}\index{AAX\_MiscUtils.h@{AAX\_MiscUtils.h}}
\mbox{\hyperlink{a00851}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ \ Copyright\ 2013-\/2015,\ 2018,\ 2023\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ CONFIDENTIAL:\ this\ document\ contains\ confidential\ information\ of\ Avid.\ Do}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ not\ disclose\ to\ any\ third\ party.\ Use\ of\ the\ information\ contained\ in\ this}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ document\ is\ subject\ to\ an\ Avid\ SDK\ license.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00017\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#ifndef\ AAX\_MISCUTILS\_H}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ AAX\_MISCUTILS\_H}}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00833}{AAX\_PlatformOptimizationConstants.h}}"{}}}
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00830}{AAX\_Constants.h}}"{}}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#if\ defined(\_MSC\_VER)}}
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ \_\_declspec(align(x))\ t\ v}}
\DoxyCodeLine{00028\ \textcolor{comment}{//\ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00029\ \textcolor{preprocessor}{\#elif\ defined\ (\_\_GNUC\_\_)}}
\DoxyCodeLine{00030\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v\ \_\_attribute\_\_\ ((aligned\ (x)))}}
\DoxyCodeLine{00031\ \textcolor{comment}{//\ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00032\ \textcolor{preprocessor}{\#elif\ defined\ (\_TMS320C6X)}}
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\ \ \ \ \#warn\ "{}DECLARE\_ALIGNED\ macro\ does\ not\ currently\ align\ data\ on\ TI"{}}}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\ \ \ \ \#error\ "{}DigiError:\ Please\ port\ the\ DECLARE\_ALIGNED\ macro\ to\ this\ platform"{}}}
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00045\ \textcolor{preprocessor}{\#ifdef\ \_TMS320C6X}}
\DoxyCodeLine{00046\ \textcolor{preprocessor}{\#define\ AAX\_ALIGNMENT\_HINT(a,b)\ \ \ \ \ std::\_nassert(((int)(a)\ \%\ b)\ ==\ 0)}}
\DoxyCodeLine{00047\ \textcolor{preprocessor}{\#define\ AAX\_WORD\_ALIGNED\_HINT(a)\ \ \ \ \ \ \ \ AAX\_ALIGNMENT\_HINT(a,4)}}
\DoxyCodeLine{00048\ \textcolor{preprocessor}{\#define\ AAX\_DWORD\_ALIGNED\_HINT(a)\ \ \ \ \ \ \ AAX\_ALIGNMENT\_HINT(a,8)}}
\DoxyCodeLine{00049\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00050\ \textcolor{preprocessor}{\#define\ AAX\_ALIGNMENT\_HINT(a,b)}}
\DoxyCodeLine{00051\ \textcolor{preprocessor}{\#define\ AAX\_WORD\_ALIGNED\_HINT(a)}}
\DoxyCodeLine{00052\ \textcolor{preprocessor}{\#define\ AAX\_DWORD\_ALIGNED\_HINT(a)}}
\DoxyCodeLine{00053\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00060\ \textcolor{preprocessor}{\#ifdef\ \_TMS320C6X}}
\DoxyCodeLine{00061\ \textcolor{preprocessor}{\#define\ AAX\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\_itof(\_lo((\_amemd8\_const(\&x)))))}}
\DoxyCodeLine{00062\ \textcolor{preprocessor}{\#define\ AAX\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\_itof(\_hi((\_amemd8\_const(\&x)))))}}
\DoxyCodeLine{00063\ \textcolor{preprocessor}{\#define\ AAX\_INT\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ (\_lo((\_amemd8\_const(\&x))))}}
\DoxyCodeLine{00064\ \textcolor{preprocessor}{\#define\ AAX\_INT\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ (\_hi((\_amemd8\_const(\&x))))}}
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#else\ \ \ }\textcolor{comment}{//for\ non-\/TI\ systems\ increment\ pointer\ by\ 4-\/bytes\ to\ simulate\ hi-\/word\ access}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#define\ AAX\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ x}}
\DoxyCodeLine{00067\ \textcolor{preprocessor}{\#define\ AAX\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *((const\_cast<float*>(\&x))+1)}}
\DoxyCodeLine{00068\ \textcolor{preprocessor}{\#define\ AAX\_INT\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ x}}
\DoxyCodeLine{00069\ \textcolor{preprocessor}{\#define\ AAX\_INT\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ *((const\_cast<int32\_t*>(reinterpret\_cast<const\ int32\_t*>(\&x)))+1)}}
\DoxyCodeLine{00070\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{keyword}{namespace\ }\mbox{\hyperlink{a00935}{AAX}}}
\DoxyCodeLine{00076\ \{}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ GFLOAT>}
\DoxyCodeLine{00079\ \textcolor{keyword}{inline}\ GFLOAT\ \mbox{\hyperlink{a00935_a6b1f85f5d8c5837ff52212e13b84e6d0}{ClampToZero}}(GFLOAT\ iValue,\ GFLOAT\ iClampThreshold)}
\DoxyCodeLine{00080\ \{}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordflow}{return}\ (iValue\ <\ iClampThreshold\ \&\&\ iValue\ >\ -\/iClampThreshold)\ ?\ 0.0\ :\ iValue;}
\DoxyCodeLine{00082\ \}}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \textcolor{comment}{/*template<class\ GFLOAT>}}
\DoxyCodeLine{00085\ \textcolor{comment}{class\ SmoothingFilter}}
\DoxyCodeLine{00086\ \textcolor{comment}{\{}}
\DoxyCodeLine{00087\ \textcolor{comment}{public:}}
\DoxyCodeLine{00088\ \textcolor{comment}{\ \ \ \ SmoothingFilter()\ \{\ Reset();\ \}}}
\DoxyCodeLine{00089\ \textcolor{comment}{\ \ \ \ void\ Reset(void)\ \{\ mYnm1=0.0;\ \}}}
\DoxyCodeLine{00090\ \textcolor{comment}{\ \ \ \ void\ Reset(double\ iInitialState)\ \{\ mYnm1=iInitialState;\ \}}}
\DoxyCodeLine{00091\ \textcolor{comment}{\ \ \ \ void\ SetSmothingRate(double\ iFrequency,\ double\ iSampleRate)\ \{\ mZeroCoef\ =\ 1.0-\/std::exp(iFrequency*-\/cTwoPi/iSampleRate);\ \}}}
\DoxyCodeLine{00092\ \textcolor{comment}{\ \ \ \ void\ SetSmoothingCoeff(GFLOAT\ b0)\ \{\ mZeroCoef\ =\ b0;\ \}}}
\DoxyCodeLine{00093\ \textcolor{comment}{\ \ \ \ inline\ GFLOAT\ Smooth(GFLOAT\ iInput)\ }}
\DoxyCodeLine{00094\ \textcolor{comment}{\ \ \ \ \{\ }}
\DoxyCodeLine{00095\ \textcolor{comment}{\ \ \ \ \ \ \ \ mYnm1\ +=\ mZeroCoef\ *\ (iInput\ -\/\ mYnm1);}}
\DoxyCodeLine{00096\ \textcolor{comment}{\ \ \ \ \ \ \ \ DeDenormal(mYnm1);\ }}
\DoxyCodeLine{00097\ \textcolor{comment}{\ \ \ \ \ \ \ \ return\ (GFLOAT)mYnm1;}}
\DoxyCodeLine{00098\ \textcolor{comment}{\ \ \ \ \}}}
\DoxyCodeLine{00099\ \textcolor{comment}{}}
\DoxyCodeLine{00100\ \textcolor{comment}{private:}}
\DoxyCodeLine{00101\ \textcolor{comment}{\ \ \ \ double\ mYnm1;\ //\ y[n-\/1]}}
\DoxyCodeLine{00102\ \textcolor{comment}{\ \ \ \ GFLOAT\ mZeroCoef;}}
\DoxyCodeLine{00103\ \textcolor{comment}{\};*/}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00935_a21944b08bd8a0f5d759094500571f57e}{ZeroMemorySW}}(\textcolor{keywordtype}{void}*\ iPointer,\ \textcolor{keywordtype}{int}\ iNumBytes)}
\DoxyCodeLine{00106\ \{}
\DoxyCodeLine{00107\ \ \ \ \ \textcolor{keywordtype}{char}*\ aCharPointer=\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(iPointer);}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ aIndex=0;\ aIndex<iNumBytes;\ aIndex++)}
\DoxyCodeLine{00110\ \ \ \ \ \{}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ *aCharPointer=0;}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ aCharPointer++;}
\DoxyCodeLine{00113\ \ \ \ \ \}}
\DoxyCodeLine{00114\ \}}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ \textcolor{comment}{//Warning:\ the\ number\ of\ bytes\ passed\ in\ must\ be\ multiple\ of\ 4}}
\DoxyCodeLine{00117\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00935_a0e598e79488a12354e9dbc340fa99b5a}{ZeroMemoryDW}}(\textcolor{keywordtype}{void}*\ iPointer,\ \textcolor{keywordtype}{int}\ iNumBytes)}
\DoxyCodeLine{00118\ \{}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keywordtype}{int}*\ aDWPointer=\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(iPointer);}
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keywordtype}{int}\ numDWords=iNumBytes/\textcolor{keyword}{sizeof}(int);}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ aIndex=0;\ aIndex<numDWords;\ aIndex++)}
\DoxyCodeLine{00123\ \ \ \ \ \{}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ *aDWPointer=0;}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ aDWPointer++;}
\DoxyCodeLine{00126\ \ \ \ \ \}}
\DoxyCodeLine{00127\ \}}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}\ N>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00935_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )}
\DoxyCodeLine{00130\ \{}
\DoxyCodeLine{00131\ \textcolor{comment}{//\ \ std::fill\_n(\ iArray,\ N,\ iVal\ );}}
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ N;\ ++i)}
\DoxyCodeLine{00133\ \ \ \ \ \{}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ *(iArray\ +\ i)\ =\ *iVal;}
\DoxyCodeLine{00135\ \ \ \ \ \}}
\DoxyCodeLine{00136\ \}}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ \textcolor{keyword}{template}<\ \textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}\ M,\ \textcolor{keywordtype}{int}\ N\ >\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \ \mbox{\hyperlink{a00935_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )\textcolor{comment}{//Fill(\ T\ (\&iArray)[M][N],\ const\ T\&\ iVal\ )}}
\DoxyCodeLine{00139\ \{}
\DoxyCodeLine{00140\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ M;\ ++i\ )}
\DoxyCodeLine{00141\ \ \ \ \ \{}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00935_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ iArray\ +\ i,\ iVal\ );}
\DoxyCodeLine{00143\ \ \ \ \ \}}
\DoxyCodeLine{00144\ \}}
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \textcolor{keyword}{template}<\ \textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}\ L,\ \textcolor{keywordtype}{int}\ M,\ \textcolor{keywordtype}{int}\ N\ >\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \ \mbox{\hyperlink{a00935_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )\ \textcolor{comment}{//Fill(\ T\ (\&iArray)[L][M][N],\ const\ T\&\ iVal\ )}}
\DoxyCodeLine{00147\ \{}
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ L;\ ++i\ )}
\DoxyCodeLine{00149\ \ \ \ \ \{}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00935_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ iArray\ +\ i,\ iVal\ );}
\DoxyCodeLine{00151\ \ \ \ \ \}}
\DoxyCodeLine{00152\ \}}
\DoxyCodeLine{00153\ }
\DoxyCodeLine{00154\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ cSignBitWord\ =\ \mbox{\hyperlink{a00935_af7fcadf3ad159bf29bbe5a1c494827f2}{cLittleEndian}};}
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ \textcolor{keywordtype}{double}\ }
\DoxyCodeLine{00157\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00935_aa4fa4d0765a764b020102cdbff8b45b0}{fabs}}(\textcolor{keywordtype}{double}\ iVal)}
\DoxyCodeLine{00158\ \{}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{comment}{//On\ Windows\ this\ version\ is\ slower\ than\ std::fabs\ so\ use\ that\ instead.}}
\DoxyCodeLine{00160\ \textcolor{preprocessor}{\#if\ defined(MAC\_VERSION)}}
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordtype}{double}\ aVal\ =\ iVal;}
\DoxyCodeLine{00162\ \ \ \ \ \textcolor{keywordtype}{int}*\ tempptr\ =\ (\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(\&aVal))+cSignBitWord;}
\DoxyCodeLine{00163\ \ \ \ \ *tempptr\ \&=\ 0x7fffffff;}
\DoxyCodeLine{00164\ }
\DoxyCodeLine{00165\ \ \ \ \ \textcolor{keywordflow}{return}\ aVal;}
\DoxyCodeLine{00166\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00167\ \ \ \ \ \textcolor{keywordflow}{return}\ std::fabs(iVal);}
\DoxyCodeLine{00168\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00169\ \}}
\DoxyCodeLine{00170\ }
\DoxyCodeLine{00171\ \textcolor{keywordtype}{float}\ }
\DoxyCodeLine{00172\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00935_aa4fa4d0765a764b020102cdbff8b45b0}{fabs}}(\textcolor{keywordtype}{float}\ iVal)}
\DoxyCodeLine{00173\ \{}
\DoxyCodeLine{00174\ \ \ \ \ \textcolor{comment}{//\ Call\ intrinsic\ if\ on\ TI\ c6727.\ fabs\ is\ about\ the\ same\ speed\ as\ std::fabs,}}
\DoxyCodeLine{00175\ \ \ \ \ \textcolor{comment}{//\ although\ metrowerks\ v9.5\ MSL\ libraries\ are\ much\ slower\ so\ for\ the\ time\ }}
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{comment}{//\ being\ were\ using\ this.}}
\DoxyCodeLine{00177\ \ \ \ \ \textcolor{keywordtype}{int}\ temp\ =\ (*(\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(\&iVal))\ \&\ 0x7fffffff);}
\DoxyCodeLine{00178\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{float}*\textcolor{keyword}{>}(\&temp);}
\DoxyCodeLine{00179\ \}}
\DoxyCodeLine{00180\ }
\DoxyCodeLine{00181\ \textcolor{keywordtype}{float}\ }
\DoxyCodeLine{00182\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00935_a7fc4d4cd59850b8b875d085467ff5850}{fabsf}}(\textcolor{keywordtype}{float}\ iVal)}
\DoxyCodeLine{00183\ \{}
\DoxyCodeLine{00184\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{a00935_aa4fa4d0765a764b020102cdbff8b45b0}{AAX::fabs}}\ (iVal);}
\DoxyCodeLine{00185\ \}}
\DoxyCodeLine{00186\ }
\DoxyCodeLine{00187\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00188\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00935_aa4cbb7d8707ad89fc5ba5169ebb75201}{AbsMax}}(\textcolor{keyword}{const}\ T\&\ iValue,\ \textcolor{keyword}{const}\ T\&\ iMax)}
\DoxyCodeLine{00189\ \{}
\DoxyCodeLine{00190\ \ \ \ \ \textcolor{keywordflow}{return}\ std::fabs(iValue)\ <\ std::fabs(iMax)\ ?\ iMax\ :\ iValue;}
\DoxyCodeLine{00191\ \}}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00193\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00194\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00935_aca59c4cdf56130ee251118c02a9963e3}{MinMax}}(\textcolor{keyword}{const}\ T\&\ iValue,\ \textcolor{keyword}{const}\ T\&\ iMin,\ \textcolor{keyword}{const}\ T\&\ iMax)}
\DoxyCodeLine{00195\ \{}
\DoxyCodeLine{00196\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue\ >\ iMax\ ?\ iMax\ :\ (iValue\ <\ iMin\ ?\ iMin\ :\ iValue);}
\DoxyCodeLine{00197\ \}}
\DoxyCodeLine{00198\ }
\DoxyCodeLine{00199\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00200\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00935_a55ac62cf1b543338c58f8dd0d747c56c}{Max}}(\textcolor{keyword}{const}\ T\&\ iValue1,\ \textcolor{keyword}{const}\ T\&\ iValue2)}
\DoxyCodeLine{00201\ \{}
\DoxyCodeLine{00202\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue1\ >\ iValue2\ ?\ iValue1\ :\ iValue2;}
\DoxyCodeLine{00203\ \}}
\DoxyCodeLine{00204\ \ \ \ \ }
\DoxyCodeLine{00205\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00206\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00935_a38c17ad30c1eb394bfa06e662d8d2598}{Min}}(\textcolor{keyword}{const}\ T\&\ iValue1,\ \textcolor{keyword}{const}\ T\&\ iValue2)}
\DoxyCodeLine{00207\ \{}
\DoxyCodeLine{00208\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue1\ <\ iValue2\ ?\ iValue1\ :\ iValue2;}
\DoxyCodeLine{00209\ \}}
\DoxyCodeLine{00210\ }
\DoxyCodeLine{00211\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00212\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00935_ab6a3e1aef81cd84dec2eee9a27755bb0}{Sign}}(\textcolor{keyword}{const}\ T\&\ iValue)}
\DoxyCodeLine{00213\ \{}
\DoxyCodeLine{00214\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue\ <\ (T)(0.0)\ ?\ (T)(-\/1.0)\ :\ (T)(1.0);}
\DoxyCodeLine{00215\ \}}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ \textcolor{comment}{//Polynomial\ evaluation.}}
\DoxyCodeLine{00218\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{a00935_aa0094a6a87ca0c48f58b48ce5eea636e}{PolyEval}}(\textcolor{keywordtype}{double}\ x,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ coefs,\ \textcolor{keywordtype}{int}\ numCoefs)}
\DoxyCodeLine{00219\ \{}
\DoxyCodeLine{00220\ \ \ \ \ \textcolor{comment}{//\ Coefs\ are\ ordered\ from\ highest\ degree\ to\ lowest\ (Matlab\ convention)}}
\DoxyCodeLine{00221\ \ \ \ \ \textcolor{keywordflow}{if}(numCoefs\ <\ 1)\ \textcolor{keywordflow}{return}\ 0.0;}
\DoxyCodeLine{00222\ \ \ \ \ }
\DoxyCodeLine{00223\ \ \ \ \ \textcolor{keywordtype}{double}\ result\ =\ coefs[0];}
\DoxyCodeLine{00224\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <\ numCoefs;\ ++i)}
\DoxyCodeLine{00225\ \ \ \ \ \{}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ result\ =\ result*x\ +\ coefs[i];}
\DoxyCodeLine{00227\ \ \ \ \ \};}
\DoxyCodeLine{00228\ }
\DoxyCodeLine{00229\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00230\ \}}
\DoxyCodeLine{00231\ }
\DoxyCodeLine{00232\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{a00935_aad5df8c4502619ca12136a2f7b8d8a06}{CeilLog2}}(\textcolor{keywordtype}{double}\ iValue)}
\DoxyCodeLine{00233\ \{}
\DoxyCodeLine{00234\ \ \ \ \ \textcolor{keywordflow}{return}\ std::pow(2.0f,\ (\textcolor{keywordtype}{float})(std::ceil(std::log(iValue)/std::log(2.0f))));}
\DoxyCodeLine{00235\ \}}
\DoxyCodeLine{00236\ }
\DoxyCodeLine{00237\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00935_a3826233eb62186c03bb093f1031ca8f4}{SinCosMix}}(\textcolor{keywordtype}{float}\ aLinearMix,\ \textcolor{keywordtype}{float}\ \&aSinMix,\ \textcolor{keywordtype}{float}\ \&aCosMix)}
\DoxyCodeLine{00238\ \{}
\DoxyCodeLine{00239\ \ \ \ \ aSinMix=\textcolor{keyword}{static\_cast<}\ \textcolor{keywordtype}{float}\ \textcolor{keyword}{>}(\ std::sin(aLinearMix*\mbox{\hyperlink{a00935_a5496b80979f89206ab4966721ef09e07}{cHalfPi}})\ );}
\DoxyCodeLine{00240\ \ \ \ \ aCosMix=\textcolor{keyword}{static\_cast<}\ \textcolor{keywordtype}{float}\ \textcolor{keyword}{>}(\ std::cos(aLinearMix*\mbox{\hyperlink{a00935_a5496b80979f89206ab4966721ef09e07}{cHalfPi}})\ );}
\DoxyCodeLine{00241\ \}}
\DoxyCodeLine{00242\ }
\DoxyCodeLine{00243\ }
\DoxyCodeLine{00244\ \}\ \textcolor{comment}{//\ namespace\ AAX}}
\DoxyCodeLine{00245\ }
\DoxyCodeLine{00246\ }
\DoxyCodeLine{00247\ \textcolor{comment}{//\ Some\ methods\ have\ been\ broken\ off\ into\ AAX\_Denormal.h;\ including}}
\DoxyCodeLine{00248\ \textcolor{comment}{//\ AAX\_Denormal.h\ here\ for\ compatibility\ with\ projects\ that\ have\ not}}
\DoxyCodeLine{00249\ \textcolor{comment}{//\ yet\ been\ updated\ to\ include\ this\ new\ header.}}
\DoxyCodeLine{00250\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00842}{AAX\_Denormal.h}}"{}}}
\DoxyCodeLine{00251\ }
\DoxyCodeLine{00252\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ AAX\_MISCUTILS\_H}}

\end{DoxyCode}
