\hypertarget{a00863_source}{}\doxysection{AAX\+\_\+\+Misc\+Utils.\+h}
\label{a00863_source}\index{AAX\_MiscUtils.h@{AAX\_MiscUtils.h}}
\mbox{\hyperlink{a00863}{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-\/2024\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ This\ file\ is\ part\ of\ the\ Avid\ AAX\ SDK.}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ The\ AAX\ SDK\ is\ subject\ to\ commercial\ or\ open-\/source\ licensing.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ By\ using\ the\ AAX\ SDK,\ you\ agree\ to\ the\ terms\ of\ both\ the\ Avid\ AAX\ SDK\ License}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ Agreement\ and\ Avid\ Privacy\ Policy.}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ AAX\ SDK\ License:\ https://developer.avid.com/aax}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ Privacy\ Policy:\ https://www.avid.com/legal/privacy-\/policy-\/statement}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ Or:\ You\ may\ also\ use\ this\ code\ under\ the\ terms\ of\ the\ GPL\ v3\ (see}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ \ www.gnu.org/licenses).}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ \ THE\ AAX\ SDK\ IS\ PROVIDED\ "{}AS\ IS"{}\ WITHOUT\ ANY\ WARRANTY,\ AND\ ALL\ WARRANTIES,\ WHETHER}}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ \ EXPRESSED\ OR\ IMPLIED,\ INCLUDING\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ PURPOSE,\ ARE}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ \ DISCLAIMED.}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00030\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00031\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\#ifndef\ AAX\_MISCUTILS\_H}}
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\#define\ AAX\_MISCUTILS\_H}}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00845}{AAX\_PlatformOptimizationConstants.h}}"{}}}
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00842}{AAX\_Constants.h}}"{}}}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#if\ defined(\_MSC\_VER)}}
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ \_\_declspec(align(x))\ t\ v}}
\DoxyCodeLine{00041\ \textcolor{comment}{//\ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00042\ \textcolor{preprocessor}{\#elif\ defined\ (\_\_GNUC\_\_)}}
\DoxyCodeLine{00043\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v\ \_\_attribute\_\_\ ((aligned\ (x)))}}
\DoxyCodeLine{00044\ \textcolor{comment}{//\ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00045\ \textcolor{preprocessor}{\#elif\ defined\ (\_TMS320C6X)}}
\DoxyCodeLine{00046\ \textcolor{preprocessor}{\ \ \ \ \#define\ DECLARE\_ALIGNED(t,v,x)\ \ \ \ \ \ t\ v}}
\DoxyCodeLine{00047\ \textcolor{preprocessor}{\ \ \ \ \#warn\ "{}DECLARE\_ALIGNED\ macro\ does\ not\ currently\ align\ data\ on\ TI"{}}}
\DoxyCodeLine{00048\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00049\ \textcolor{preprocessor}{\ \ \ \ \#error\ "{}DigiError:\ Please\ port\ the\ DECLARE\_ALIGNED\ macro\ to\ this\ platform"{}}}
\DoxyCodeLine{00050\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00058\ \textcolor{preprocessor}{\#ifdef\ \_TMS320C6X}}
\DoxyCodeLine{00059\ \textcolor{preprocessor}{\#define\ AAX\_ALIGNMENT\_HINT(a,b)\ \ \ \ \ std::\_nassert(((int)(a)\ \%\ b)\ ==\ 0)}}
\DoxyCodeLine{00060\ \textcolor{preprocessor}{\#define\ AAX\_WORD\_ALIGNED\_HINT(a)\ \ \ \ \ \ \ \ AAX\_ALIGNMENT\_HINT(a,4)}}
\DoxyCodeLine{00061\ \textcolor{preprocessor}{\#define\ AAX\_DWORD\_ALIGNED\_HINT(a)\ \ \ \ \ \ \ AAX\_ALIGNMENT\_HINT(a,8)}}
\DoxyCodeLine{00062\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00063\ \textcolor{preprocessor}{\#define\ AAX\_ALIGNMENT\_HINT(a,b)}}
\DoxyCodeLine{00064\ \textcolor{preprocessor}{\#define\ AAX\_WORD\_ALIGNED\_HINT(a)}}
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#define\ AAX\_DWORD\_ALIGNED\_HINT(a)}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00073\ \textcolor{preprocessor}{\#ifdef\ \_TMS320C6X}}
\DoxyCodeLine{00074\ \textcolor{preprocessor}{\#define\ AAX\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\_itof(\_lo((\_amemd8\_const(\&x)))))}}
\DoxyCodeLine{00075\ \textcolor{preprocessor}{\#define\ AAX\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\_itof(\_hi((\_amemd8\_const(\&x)))))}}
\DoxyCodeLine{00076\ \textcolor{preprocessor}{\#define\ AAX\_INT\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ (\_lo((\_amemd8\_const(\&x))))}}
\DoxyCodeLine{00077\ \textcolor{preprocessor}{\#define\ AAX\_INT\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ (\_hi((\_amemd8\_const(\&x))))}}
\DoxyCodeLine{00078\ \textcolor{preprocessor}{\#else\ \ \ }\textcolor{comment}{//for\ non-\/TI\ systems\ increment\ pointer\ by\ 4-\/bytes\ to\ simulate\ hi-\/word\ access}}
\DoxyCodeLine{00079\ \textcolor{preprocessor}{\#define\ AAX\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ x}}
\DoxyCodeLine{00080\ \textcolor{preprocessor}{\#define\ AAX\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *((const\_cast<float*>(\&x))+1)}}
\DoxyCodeLine{00081\ \textcolor{preprocessor}{\#define\ AAX\_INT\_LO(x)\ \ \ \ \ \ \ \ \ \ \ \ \ x}}
\DoxyCodeLine{00082\ \textcolor{preprocessor}{\#define\ AAX\_INT\_HI(x)\ \ \ \ \ \ \ \ \ \ \ \ \ *((const\_cast<int32\_t*>(reinterpret\_cast<const\ int32\_t*>(\&x)))+1)}}
\DoxyCodeLine{00083\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \textcolor{keyword}{namespace\ }\mbox{\hyperlink{a00948}{AAX}}}
\DoxyCodeLine{00089\ \{}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ GFLOAT>}
\DoxyCodeLine{00092\ \textcolor{keyword}{inline}\ GFLOAT\ \mbox{\hyperlink{a00948_a6b1f85f5d8c5837ff52212e13b84e6d0}{ClampToZero}}(GFLOAT\ iValue,\ GFLOAT\ iClampThreshold)}
\DoxyCodeLine{00093\ \{}
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keywordflow}{return}\ (iValue\ <\ iClampThreshold\ \&\&\ iValue\ >\ -\/iClampThreshold)\ ?\ 0.0\ :\ iValue;}
\DoxyCodeLine{00095\ \}}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ \textcolor{comment}{/*template<class\ GFLOAT>}}
\DoxyCodeLine{00098\ \textcolor{comment}{class\ SmoothingFilter}}
\DoxyCodeLine{00099\ \textcolor{comment}{\{}}
\DoxyCodeLine{00100\ \textcolor{comment}{public:}}
\DoxyCodeLine{00101\ \textcolor{comment}{\ \ \ \ SmoothingFilter()\ \{\ Reset();\ \}}}
\DoxyCodeLine{00102\ \textcolor{comment}{\ \ \ \ void\ Reset(void)\ \{\ mYnm1=0.0;\ \}}}
\DoxyCodeLine{00103\ \textcolor{comment}{\ \ \ \ void\ Reset(double\ iInitialState)\ \{\ mYnm1=iInitialState;\ \}}}
\DoxyCodeLine{00104\ \textcolor{comment}{\ \ \ \ void\ SetSmothingRate(double\ iFrequency,\ double\ iSampleRate)\ \{\ mZeroCoef\ =\ 1.0-\/std::exp(iFrequency*-\/cTwoPi/iSampleRate);\ \}}}
\DoxyCodeLine{00105\ \textcolor{comment}{\ \ \ \ void\ SetSmoothingCoeff(GFLOAT\ b0)\ \{\ mZeroCoef\ =\ b0;\ \}}}
\DoxyCodeLine{00106\ \textcolor{comment}{\ \ \ \ inline\ GFLOAT\ Smooth(GFLOAT\ iInput)\ }}
\DoxyCodeLine{00107\ \textcolor{comment}{\ \ \ \ \{\ }}
\DoxyCodeLine{00108\ \textcolor{comment}{\ \ \ \ \ \ \ \ mYnm1\ +=\ mZeroCoef\ *\ (iInput\ -\/\ mYnm1);}}
\DoxyCodeLine{00109\ \textcolor{comment}{\ \ \ \ \ \ \ \ DeDenormal(mYnm1);\ }}
\DoxyCodeLine{00110\ \textcolor{comment}{\ \ \ \ \ \ \ \ return\ (GFLOAT)mYnm1;}}
\DoxyCodeLine{00111\ \textcolor{comment}{\ \ \ \ \}}}
\DoxyCodeLine{00112\ \textcolor{comment}{}}
\DoxyCodeLine{00113\ \textcolor{comment}{private:}}
\DoxyCodeLine{00114\ \textcolor{comment}{\ \ \ \ double\ mYnm1;\ //\ y[n-\/1]}}
\DoxyCodeLine{00115\ \textcolor{comment}{\ \ \ \ GFLOAT\ mZeroCoef;}}
\DoxyCodeLine{00116\ \textcolor{comment}{\};*/}}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00948_a21944b08bd8a0f5d759094500571f57e}{ZeroMemorySW}}(\textcolor{keywordtype}{void}*\ iPointer,\ \textcolor{keywordtype}{int}\ iNumBytes)}
\DoxyCodeLine{00119\ \{}
\DoxyCodeLine{00120\ \ \ \ \ \textcolor{keywordtype}{char}*\ aCharPointer=\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(iPointer);}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ aIndex=0;\ aIndex<iNumBytes;\ aIndex++)}
\DoxyCodeLine{00123\ \ \ \ \ \{}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ *aCharPointer=0;}
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ aCharPointer++;}
\DoxyCodeLine{00126\ \ \ \ \ \}}
\DoxyCodeLine{00127\ \}}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \textcolor{comment}{//Warning:\ the\ number\ of\ bytes\ passed\ in\ must\ be\ multiple\ of\ 4}}
\DoxyCodeLine{00130\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00948_a0e598e79488a12354e9dbc340fa99b5a}{ZeroMemoryDW}}(\textcolor{keywordtype}{void}*\ iPointer,\ \textcolor{keywordtype}{int}\ iNumBytes)}
\DoxyCodeLine{00131\ \{}
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordtype}{int}*\ aDWPointer=\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(iPointer);}
\DoxyCodeLine{00133\ }
\DoxyCodeLine{00134\ \ \ \ \ \textcolor{keywordtype}{int}\ numDWords=iNumBytes/\textcolor{keyword}{sizeof}(int);}
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ aIndex=0;\ aIndex<numDWords;\ aIndex++)}
\DoxyCodeLine{00136\ \ \ \ \ \{}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ *aDWPointer=0;}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ aDWPointer++;}
\DoxyCodeLine{00139\ \ \ \ \ \}}
\DoxyCodeLine{00140\ \}}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}\ N>\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00948_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )}
\DoxyCodeLine{00143\ \{}
\DoxyCodeLine{00144\ \textcolor{comment}{//\ \ std::fill\_n(\ iArray,\ N,\ iVal\ );}}
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ N;\ ++i)}
\DoxyCodeLine{00146\ \ \ \ \ \{}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ *(iArray\ +\ i)\ =\ *iVal;}
\DoxyCodeLine{00148\ \ \ \ \ \}}
\DoxyCodeLine{00149\ \}}
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \textcolor{keyword}{template}<\ \textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}\ M,\ \textcolor{keywordtype}{int}\ N\ >\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \ \mbox{\hyperlink{a00948_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )\textcolor{comment}{//Fill(\ T\ (\&iArray)[M][N],\ const\ T\&\ iVal\ )}}
\DoxyCodeLine{00152\ \{}
\DoxyCodeLine{00153\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ M;\ ++i\ )}
\DoxyCodeLine{00154\ \ \ \ \ \{}
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00948_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ iArray\ +\ i,\ iVal\ );}
\DoxyCodeLine{00156\ \ \ \ \ \}}
\DoxyCodeLine{00157\ \}}
\DoxyCodeLine{00158\ }
\DoxyCodeLine{00159\ \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{a00948_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ T\ *iArray,\ \textcolor{keyword}{const}\ T*\ iVal\ )\ \textcolor{comment}{//Fill(\ T\ (\&iArray)[L][M][N],\ const\ T\&\ iVal\ )}}
\DoxyCodeLine{00160\ \{}
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ !=\ L;\ ++i\ )}
\DoxyCodeLine{00162\ \ \ \ \ \{}
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00948_a1e72222769ecdf34fa73ae38c0c709df}{Fill}}(\ iArray\ +\ i,\ iVal\ );}
\DoxyCodeLine{00164\ \ \ \ \ \}}
\DoxyCodeLine{00165\ \}}
\DoxyCodeLine{00166\ }
\DoxyCodeLine{00167\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ cSignBitWord\ =\ \mbox{\hyperlink{a00948_af7fcadf3ad159bf29bbe5a1c494827f2}{cLittleEndian}};}
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{keywordtype}{double}\ }
\DoxyCodeLine{00170\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00948_aa4fa4d0765a764b020102cdbff8b45b0}{fabs}}(\textcolor{keywordtype}{double}\ iVal)}
\DoxyCodeLine{00171\ \{}
\DoxyCodeLine{00172\ \ \ \ \ \textcolor{comment}{//On\ Windows\ this\ version\ is\ slower\ than\ std::fabs\ so\ use\ that\ instead.}}
\DoxyCodeLine{00173\ \textcolor{preprocessor}{\#if\ defined(MAC\_VERSION)}}
\DoxyCodeLine{00174\ \ \ \ \ \textcolor{keywordtype}{double}\ aVal\ =\ iVal;}
\DoxyCodeLine{00175\ \ \ \ \ \textcolor{keywordtype}{int}*\ tempptr\ =\ (\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(\&aVal))+cSignBitWord;}
\DoxyCodeLine{00176\ \ \ \ \ *tempptr\ \&=\ 0x7fffffff;}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ \ \ \ \ \textcolor{keywordflow}{return}\ aVal;}
\DoxyCodeLine{00179\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00180\ \ \ \ \ \textcolor{keywordflow}{return}\ std::fabs(iVal);}
\DoxyCodeLine{00181\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00182\ \}}
\DoxyCodeLine{00183\ }
\DoxyCodeLine{00184\ \textcolor{keywordtype}{float}\ }
\DoxyCodeLine{00185\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00948_aa4fa4d0765a764b020102cdbff8b45b0}{fabs}}(\textcolor{keywordtype}{float}\ iVal)}
\DoxyCodeLine{00186\ \{}
\DoxyCodeLine{00187\ \ \ \ \ \textcolor{comment}{//\ Call\ intrinsic\ if\ on\ TI\ c6727.\ fabs\ is\ about\ the\ same\ speed\ as\ std::fabs,}}
\DoxyCodeLine{00188\ \ \ \ \ \textcolor{comment}{//\ although\ metrowerks\ v9.5\ MSL\ libraries\ are\ much\ slower\ so\ for\ the\ time\ }}
\DoxyCodeLine{00189\ \ \ \ \ \textcolor{comment}{//\ being\ were\ using\ this.}}
\DoxyCodeLine{00190\ \ \ \ \ \textcolor{keywordtype}{int}\ temp\ =\ (*(\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{int}*\textcolor{keyword}{>}(\&iVal))\ \&\ 0x7fffffff);}
\DoxyCodeLine{00191\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{float}*\textcolor{keyword}{>}(\&temp);}
\DoxyCodeLine{00192\ \}}
\DoxyCodeLine{00193\ }
\DoxyCodeLine{00194\ \textcolor{keywordtype}{float}\ }
\DoxyCodeLine{00195\ \textcolor{keyword}{inline}\ \mbox{\hyperlink{a00948_a7fc4d4cd59850b8b875d085467ff5850}{fabsf}}(\textcolor{keywordtype}{float}\ iVal)}
\DoxyCodeLine{00196\ \{}
\DoxyCodeLine{00197\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{a00948_aa4fa4d0765a764b020102cdbff8b45b0}{AAX::fabs}}\ (iVal);}
\DoxyCodeLine{00198\ \}}
\DoxyCodeLine{00199\ }
\DoxyCodeLine{00200\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00201\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00948_aa4cbb7d8707ad89fc5ba5169ebb75201}{AbsMax}}(\textcolor{keyword}{const}\ T\&\ iValue,\ \textcolor{keyword}{const}\ T\&\ iMax)}
\DoxyCodeLine{00202\ \{}
\DoxyCodeLine{00203\ \ \ \ \ \textcolor{keywordflow}{return}\ std::fabs(iValue)\ <\ std::fabs(iMax)\ ?\ iMax\ :\ iValue;}
\DoxyCodeLine{00204\ \}}
\DoxyCodeLine{00205\ }
\DoxyCodeLine{00206\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00207\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00948_aca59c4cdf56130ee251118c02a9963e3}{MinMax}}(\textcolor{keyword}{const}\ T\&\ iValue,\ \textcolor{keyword}{const}\ T\&\ iMin,\ \textcolor{keyword}{const}\ T\&\ iMax)}
\DoxyCodeLine{00208\ \{}
\DoxyCodeLine{00209\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue\ >\ iMax\ ?\ iMax\ :\ (iValue\ <\ iMin\ ?\ iMin\ :\ iValue);}
\DoxyCodeLine{00210\ \}}
\DoxyCodeLine{00211\ }
\DoxyCodeLine{00212\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00213\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00948_a55ac62cf1b543338c58f8dd0d747c56c}{Max}}(\textcolor{keyword}{const}\ T\&\ iValue1,\ \textcolor{keyword}{const}\ T\&\ iValue2)}
\DoxyCodeLine{00214\ \{}
\DoxyCodeLine{00215\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue1\ >\ iValue2\ ?\ iValue1\ :\ iValue2;}
\DoxyCodeLine{00216\ \}}
\DoxyCodeLine{00217\ \ \ \ \ }
\DoxyCodeLine{00218\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00219\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00948_a38c17ad30c1eb394bfa06e662d8d2598}{Min}}(\textcolor{keyword}{const}\ T\&\ iValue1,\ \textcolor{keyword}{const}\ T\&\ iValue2)}
\DoxyCodeLine{00220\ \{}
\DoxyCodeLine{00221\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue1\ <\ iValue2\ ?\ iValue1\ :\ iValue2;}
\DoxyCodeLine{00222\ \}}
\DoxyCodeLine{00223\ }
\DoxyCodeLine{00224\ \textcolor{keyword}{template}\ <\textcolor{keyword}{class}\ T>\ }
\DoxyCodeLine{00225\ \textcolor{keyword}{inline}\ T\ \mbox{\hyperlink{a00948_ab6a3e1aef81cd84dec2eee9a27755bb0}{Sign}}(\textcolor{keyword}{const}\ T\&\ iValue)}
\DoxyCodeLine{00226\ \{}
\DoxyCodeLine{00227\ \ \ \ \ \textcolor{keywordflow}{return}\ iValue\ <\ (T)(0.0)\ ?\ (T)(-\/1.0)\ :\ (T)(1.0);}
\DoxyCodeLine{00228\ \}}
\DoxyCodeLine{00229\ }
\DoxyCodeLine{00230\ \textcolor{comment}{//Polynomial\ evaluation.}}
\DoxyCodeLine{00231\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{a00948_aa0094a6a87ca0c48f58b48ce5eea636e}{PolyEval}}(\textcolor{keywordtype}{double}\ x,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ coefs,\ \textcolor{keywordtype}{int}\ numCoefs)}
\DoxyCodeLine{00232\ \{}
\DoxyCodeLine{00233\ \ \ \ \ \textcolor{comment}{//\ Coefs\ are\ ordered\ from\ highest\ degree\ to\ lowest\ (Matlab\ convention)}}
\DoxyCodeLine{00234\ \ \ \ \ \textcolor{keywordflow}{if}(numCoefs\ <\ 1)\ \textcolor{keywordflow}{return}\ 0.0;}
\DoxyCodeLine{00235\ \ \ \ \ }
\DoxyCodeLine{00236\ \ \ \ \ \textcolor{keywordtype}{double}\ result\ =\ coefs[0];}
\DoxyCodeLine{00237\ \ \ \ \ \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <\ numCoefs;\ ++i)}
\DoxyCodeLine{00238\ \ \ \ \ \{}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ result\ =\ result*x\ +\ coefs[i];}
\DoxyCodeLine{00240\ \ \ \ \ \};}
\DoxyCodeLine{00241\ }
\DoxyCodeLine{00242\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00243\ \}}
\DoxyCodeLine{00244\ }
\DoxyCodeLine{00245\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{a00948_aad5df8c4502619ca12136a2f7b8d8a06}{CeilLog2}}(\textcolor{keywordtype}{double}\ iValue)}
\DoxyCodeLine{00246\ \{}
\DoxyCodeLine{00247\ \ \ \ \ \textcolor{keywordflow}{return}\ std::pow(2.0f,\ (\textcolor{keywordtype}{float})(std::ceil(std::log(iValue)/std::log(2.0f))));}
\DoxyCodeLine{00248\ \}}
\DoxyCodeLine{00249\ }
\DoxyCodeLine{00250\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00948_a3826233eb62186c03bb093f1031ca8f4}{SinCosMix}}(\textcolor{keywordtype}{float}\ aLinearMix,\ \textcolor{keywordtype}{float}\ \&aSinMix,\ \textcolor{keywordtype}{float}\ \&aCosMix)}
\DoxyCodeLine{00251\ \{}
\DoxyCodeLine{00252\ \ \ \ \ aSinMix=\textcolor{keyword}{static\_cast<}\ \textcolor{keywordtype}{float}\ \textcolor{keyword}{>}(\ std::sin(aLinearMix*\mbox{\hyperlink{a00948_a5496b80979f89206ab4966721ef09e07}{cHalfPi}})\ );}
\DoxyCodeLine{00253\ \ \ \ \ aCosMix=\textcolor{keyword}{static\_cast<}\ \textcolor{keywordtype}{float}\ \textcolor{keyword}{>}(\ std::cos(aLinearMix*\mbox{\hyperlink{a00948_a5496b80979f89206ab4966721ef09e07}{cHalfPi}})\ );}
\DoxyCodeLine{00254\ \}}
\DoxyCodeLine{00255\ }
\DoxyCodeLine{00256\ }
\DoxyCodeLine{00257\ \}\ \textcolor{comment}{//\ namespace\ AAX}}
\DoxyCodeLine{00258\ }
\DoxyCodeLine{00259\ }
\DoxyCodeLine{00260\ \textcolor{comment}{//\ Some\ methods\ have\ been\ broken\ off\ into\ AAX\_Denormal.h;\ including}}
\DoxyCodeLine{00261\ \textcolor{comment}{//\ AAX\_Denormal.h\ here\ for\ compatibility\ with\ projects\ that\ have\ not}}
\DoxyCodeLine{00262\ \textcolor{comment}{//\ yet\ been\ updated\ to\ include\ this\ new\ header.}}
\DoxyCodeLine{00263\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00854}{AAX\_Denormal.h}}"{}}}
\DoxyCodeLine{00264\ }
\DoxyCodeLine{00265\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ AAX\_MISCUTILS\_H}}

\end{DoxyCode}
