Fix _aligned_malloc usage

This commit is contained in:
mayeut 2015-10-18 02:23:01 +02:00
parent 8034ffde8b
commit f9d47e28b9
1 changed files with 4 additions and 5 deletions

View File

@ -30,14 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#define OPJ_SKIP_POISON #define OPJ_SKIP_POISON
#include "opj_malloc.h" #include "opj_includes.h"
#include "opj_config_private.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include <assert.h> #include <assert.h>
static inline void *opj_aligned_alloc_n(size_t alignment, size_t size) static INLINE void *opj_aligned_alloc_n(size_t alignment, size_t size)
{ {
void* ptr; void* ptr;
@ -62,14 +61,14 @@ static inline void *opj_aligned_alloc_n(size_t alignment, size_t size)
ptr = memalign( alignment, size ); ptr = memalign( alignment, size );
/* _MSC_VER */ /* _MSC_VER */
#elif defined(HAVE__ALIGNED_MALLOC) #elif defined(HAVE__ALIGNED_MALLOC)
ptr = _aligned_malloc( alignment, size ); ptr = _aligned_malloc(size, alignment);
#else #else
/* TODO: _mm_malloc(x,y) */ /* TODO: _mm_malloc(x,y) */
#error missing aligned alloc function #error missing aligned alloc function
#endif #endif
return ptr; return ptr;
} }
static inline void *opj_aligned_realloc_n(void *ptr, size_t alignment, size_t new_size) static INLINE void *opj_aligned_realloc_n(void *ptr, size_t alignment, size_t new_size)
{ {
void *r_ptr; void *r_ptr;