1#ifndef GIM_MEMORY_H_INCLUDED
2#define GIM_MEMORY_H_INCLUDED
43#define pf(_x, _i) _mm_prefetch((void *)(_x + _i + pfval), 0)
45#define pf2(_x, _i) _mm_prefetch((void *)(_x + _i + pfval2), 0)
54#define GIM_COPY_ARRAYS(dest_array, source_array, element_count) \
56 for (GUINT _i_ = 0; _i_ < element_count; ++_i_) \
58 dest_array[_i_] = source_array[_i_]; \
62#define GIM_COPY_ARRAYS_1(dest_array, source_array, element_count, copy_macro) \
64 for (GUINT _i_ = 0; _i_ < element_count; ++_i_) \
66 copy_macro(dest_array[_i_], source_array[_i_]); \
70#define GIM_ZERO_ARRAY(array, element_count) \
72 for (GUINT _i_ = 0; _i_ < element_count; ++_i_) \
78#define GIM_CONSTANT_ARRAY(array, element_count, constant) \
80 for (GUINT _i_ = 0; _i_ < element_count; ++_i_) \
82 array[_i_] = constant; \
108void *
gim_realloc(
void *ptr,
size_t oldsize,
size_t newsize);
111#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
112#define GIM_SIMD_MEMORY 1
116#define SIMD_T GUINT64
118#define SIMD_T_SIZE sizeof(SIMD_T)
122#ifdef GIM_SIMD_MEMORY
136 char *c_src_ptr = (
char *)src;
137 char *c_dst_ptr = (
char *)dst;
140 *(c_dst_ptr++) = *(c_src_ptr++);
145 memcpy(dst, src, copysize);
152 T _e_tmp_ = _array[_i];
153 _array[_i] = _array[_j];
154 _array[_j] = _e_tmp_;
160 char _e_tmp_[
sizeof(T)];
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void gim_set_free_handler(gim_free_function *fn)
void * gim_alloc(size_t size)
Standar Memory functions.
void * gim_realloc(void *ptr, size_t oldsize, size_t newsize)
void gim_swap_elements_memcpy(T *_array, size_t _i, size_t _j)
void * gim_realloc_function(void *ptr, size_t oldsize, size_t newsize)
gim_free_function * gim_get_free_handler(void)
void gim_simd_memcpy(void *dst, const void *src, size_t copysize)
void gim_swap_elements(T *_array, size_t _i, size_t _j)
void * gim_alloca_function(size_t size)
void gim_set_alloca_handler(gim_alloca_function *fn)
gim_alloc_function * gim_get_alloc_handler(void)
get current memory management functions.
gim_realloc_function * gim_get_realloc_handler(void)
void gim_set_alloc_handler(gim_alloc_function *fn)
Memory Function Handlers set new memory management functions.
gim_alloca_function * gim_get_alloca_handler(void)
void * gim_alloca(size_t size)
void * gim_alloc_function(size_t size)
Function prototypes to allocate and free memory.
void gim_set_realloc_handler(gim_realloc_function *fn)
void gim_swap_elements_ptr(char *_array, size_t _i, size_t _j)
void gim_free_function(void *ptr)