MathFu
An open source project by
FPL.
|
SIMD-safe memory allocators. More...
SIMD-safe memory allocators.
If you use MathFu with SIMD (SSE in particular), you need to have all your allocations be 16-byte aligned (which isn't the case with the default allocators on most platforms except OS X).
You can either use simd_allocator, which solves the problem for any STL containers, but not for manual dynamic allocations or the new/delete override MATHFU_DEFINE_GLOBAL_SIMD_AWARE_NEW_DELETE will solve it for all allocations, at the cost of MATHFU_ALIGNMENT bytes per allocation.
Classes | |
class | mathfu::simd_allocator< T > |
SIMD-safe memory allocator, for use with STL types like std::vector. More... | |
Macros | |
#define | MATHFU_ALIGNMENT 16 |
Alignment (in bytes) of memory allocated by AllocateAligned. More... | |
#define | MATHFU_DEFINE_GLOBAL_SIMD_AWARE_NEW_DELETE |
Macro which overrides the default new and delete allocators. More... | |
#define | MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE |
Macro which defines the new and delete for MathFu classes. More... | |
Functions | |
void * | mathfu::AllocateAligned (size_t n) |
Allocate an aligned block of memory. More... | |
void | mathfu::FreeAligned (void *p) |
Deallocate a block of memory allocated with AllocateAligned(). More... | |
#define MATHFU_ALIGNMENT 16 |
Alignment (in bytes) of memory allocated by AllocateAligned.
#define MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE |
Macro which defines the new and delete for MathFu classes.
#define MATHFU_DEFINE_GLOBAL_SIMD_AWARE_NEW_DELETE |
Macro which overrides the default new and delete allocators.
To globally override new and delete, simply add the line:
MATHFU_DEFINE_GLOBAL_SIMD_AWARE_NEW_DELETE
to the end of your main .cpp file.
|
inline |
|
inline |
Deallocate a block of memory allocated with AllocateAligned().
p | Pointer to memory to deallocate. |