source: trunk/lib_c/mmalloc.h @ 3478

Last change on this file since 3478 was 3391, checked in by linmengl, 6 years ago

check in IDISA C library and other support libraries. Some template features still remain.

File size: 897 bytes
Line 
1/* Generated by cpp2c.rb from ./mmalloc.hpp
2 * Use IDISA C support
3*/
4
5#ifndef ALIGNED_MMALLOC_H
6#define ALIGNED_MMALLOC_H
7/*=============================================================================
8  allocator.hpp - Platform independent aligned memory allocation.
9  Created on: 06-December-2011
10  Author: Ken Herdy
11
12        Description:   
13
14        TODO -  Wrap routines inside a class scope and/or C++ custom namespace.
15
16=============================================================================*/
17
18#include "bitblock.h"
19
20#if defined USE_NEON
21        #error "Neon aligned memory allocation not implemented. Aborting compilation."
22#else // USE_SSE
23
24        template <class T> T * simd_malloc(uint32_t n) 
25        {
26                return (T*)_mm_malloc(n*sizeof(T), sizeof(BitBlock));           
27        }
28
29        template <class T> void simd_free(T* p) 
30        {
31                if(p != NULL) 
32                { 
33                        _mm_free(p); 
34                        p = NULL;                       
35                }
36
37        }
38#endif
39
40#endif // ALIGNED_MMALLOC_H
41
Note: See TracBrowser for help on using the repository browser.