OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
Class to provide aligned memory allocate functionality. More...
#include <OgreAlignedAllocator.h>
Static Public Member Functions | |
static void * | allocate (size_t size) |
Allocate memory with default platform dependent alignment. | |
static void * | allocate (size_t size, size_t alignment) |
Allocate memory with given alignment. | |
static void | deallocate (void *p) |
Deallocate memory that allocated by this class. | |
Class to provide aligned memory allocate functionality.
All SIMD processing are friendly with aligned memory, and some SIMD routines are designed for working with aligned memory only. If the data are intended to use SIMD processing, it'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't used SIMD processing. So this class provides a couple of functions for allocate aligned memory.
Allocate memory with given alignment.
size | The size of memory need to allocate. |
alignment | The alignment of result pointer, must be power of two and in range [1, 128]. |
Referenced by Ogre::AlignedAllocator< T, Alignment >::allocate(), and Ogre::AlignedAllocator< T, Alignment >::allocate().
Allocate memory with default platform dependent alignment.
The default alignment depend on target machine, this function guarantee aligned memory according with SIMD processing and cache boundary friendly.
size | The size of memory need to allocate. |
Deallocate memory that allocated by this class.
p | Pointer to the memory allocated by this class or NULL pointer. |
Referenced by Ogre::AlignedAllocator< T, Alignment >::deallocate().