\hypertarget{class_ogre_1_1_aligned_memory}{}\section{Ogre\+:\+:Aligned\+Memory Class Reference}
\label{class_ogre_1_1_aligned_memory}\index{Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}}


Class to provide aligned memory allocate functionality.  




{\ttfamily \#include $<$Ogre\+Aligned\+Allocator.\+h$>$}

\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{_ogre_platform_8h_aa1730b3ff27777dab53a340f23844db4}{D\+E\+C\+L\+\_\+\+M\+A\+L\+L\+OC} void $\ast$ \hyperlink{class_ogre_1_1_aligned_memory_a63bd1c2f3f55b989331a04fccc07356a}{allocate} (size\+\_\+t size, size\+\_\+t alignment)
\begin{DoxyCompactList}\small\item\em Allocate memory with given alignment. \end{DoxyCompactList}\item 
static \hyperlink{_ogre_platform_8h_aa1730b3ff27777dab53a340f23844db4}{D\+E\+C\+L\+\_\+\+M\+A\+L\+L\+OC} void $\ast$ \hyperlink{class_ogre_1_1_aligned_memory_ad13640994e404f2befc9b7eb72f8659c}{allocate} (size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Allocate memory with default platform dependent alignment. \end{DoxyCompactList}\item 
static void \hyperlink{class_ogre_1_1_aligned_memory_aec9665c128b282869284a6025520adee}{deallocate} (void $\ast$p)
\begin{DoxyCompactList}\small\item\em Deallocate memory that allocated by this class. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Class to provide aligned memory allocate functionality. 

\begin{DoxyRemark}{Remarks}
All S\+I\+MD processing are friendly with aligned memory, and some S\+I\+MD routines are designed for working with aligned memory only. If the data are intended to use S\+I\+MD processing, it\textquotesingle{}s need to be aligned for better performance boost. In additional, most time cache boundary aligned data also lead to better performance even if didn\textquotesingle{}t used S\+I\+MD processing. So this class provides a couple of functions for allocate aligned memory. 
\end{DoxyRemark}
\begin{DoxyParagraph}{}
Anyways, in general, you don\textquotesingle{}t need to use this class directly, \hyperlink{namespace_ogre}{Ogre} internally will take care with most S\+I\+MD and cache friendly optimisation if possible. 
\end{DoxyParagraph}
\begin{DoxyParagraph}{}
This isn\textquotesingle{}t a \char`\"{}one-\/step\char`\"{} optimisation, there are a lot of underlying work to achieve performance boost. If you didn\textquotesingle{}t know what are you doing or what there are going, just ignore this class. 
\end{DoxyParagraph}
\begin{DoxyNote}{Note}
This class intended to use by advanced user only. 
\end{DoxyNote}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_ogre_1_1_aligned_memory_a63bd1c2f3f55b989331a04fccc07356a}\label{class_ogre_1_1_aligned_memory_a63bd1c2f3f55b989331a04fccc07356a}} 
\index{Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}!allocate@{allocate}}
\index{allocate@{allocate}!Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}}
\subsubsection{\texorpdfstring{allocate()}{allocate()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily static \hyperlink{_ogre_platform_8h_aa1730b3ff27777dab53a340f23844db4}{D\+E\+C\+L\+\_\+\+M\+A\+L\+L\+OC} void$\ast$ Ogre\+::\+Aligned\+Memory\+::allocate (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{size,  }\item[{size\+\_\+t}]{alignment }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Allocate memory with given alignment. 


\begin{DoxyParams}{Parameters}
{\em size} & The size of memory need to allocate. \\
\hline
{\em alignment} & The alignment of result pointer, must be power of two and in range \mbox{[}1, 128\mbox{]}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The allocated memory pointer. 
\end{DoxyReturn}
\begin{DoxyParagraph}{}
On failure, exception will be throw. 
\end{DoxyParagraph}


Referenced by Ogre\+::\+Aligned\+Allocator$<$ T, Alignment $>$\+::allocate().

\mbox{\Hypertarget{class_ogre_1_1_aligned_memory_ad13640994e404f2befc9b7eb72f8659c}\label{class_ogre_1_1_aligned_memory_ad13640994e404f2befc9b7eb72f8659c}} 
\index{Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}!allocate@{allocate}}
\index{allocate@{allocate}!Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}}
\subsubsection{\texorpdfstring{allocate()}{allocate()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static \hyperlink{_ogre_platform_8h_aa1730b3ff27777dab53a340f23844db4}{D\+E\+C\+L\+\_\+\+M\+A\+L\+L\+OC} void$\ast$ Ogre\+::\+Aligned\+Memory\+::allocate (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Allocate memory with default platform dependent alignment. 

\begin{DoxyRemark}{Remarks}
The default alignment depend on target machine, this function guarantee aligned memory according with S\+I\+MD processing and cache boundary friendly. 
\end{DoxyRemark}

\begin{DoxyParams}{Parameters}
{\em size} & The size of memory need to allocate. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The allocated memory pointer. 
\end{DoxyReturn}
\begin{DoxyParagraph}{}
On failure, exception will be throw. 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_ogre_1_1_aligned_memory_aec9665c128b282869284a6025520adee}\label{class_ogre_1_1_aligned_memory_aec9665c128b282869284a6025520adee}} 
\index{Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}!deallocate@{deallocate}}
\index{deallocate@{deallocate}!Ogre\+::\+Aligned\+Memory@{Ogre\+::\+Aligned\+Memory}}
\subsubsection{\texorpdfstring{deallocate()}{deallocate()}}
{\footnotesize\ttfamily static void Ogre\+::\+Aligned\+Memory\+::deallocate (\begin{DoxyParamCaption}\item[{void $\ast$}]{p }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Deallocate memory that allocated by this class. 


\begin{DoxyParams}{Parameters}
{\em p} & Pointer to the memory allocated by this class or {\bfseries N\+U\+LL} pointer. \\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{}
On {\bfseries N\+U\+LL} pointer, nothing happen. 
\end{DoxyParagraph}


Referenced by Ogre\+::\+Aligned\+Allocator$<$ T, Alignment $>$\+::deallocate().



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\hyperlink{_ogre_aligned_allocator_8h}{Ogre\+Aligned\+Allocator.\+h}\end{DoxyCompactItemize}
