Bullet Collision Detection & Physics Library: gim_memory.h File Reference

Bullet Collision Detection & Physics Library

Macros | Typedefs | Functions
gim_memory.h File Reference
`#include "gim_math.h"`
`#include <string.h>`
Include dependency graph for gim_memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | pf(_x, _i)
| Prefetch 64. More...
#define | pf2(_x, _i)
| Prefetch 128. More...
#define | GIM_COPY_ARRAYS(dest_array, source_array, element_count)
| Functions for manip packed arrays of numbers. More...
#define | GIM_COPY_ARRAYS_1(dest_array, source_array, element_count, copy_macro)
#define | GIM_ZERO_ARRAY(array, element_count)
#define | GIM_CONSTANT_ARRAY(array, element_count, constant)
#define | GIM_SIMD_MEMORY 1
#define | SIMD_T GUINT64
| SIMD POINTER INTEGER. More...
#define | SIMD_T_SIZE sizeof(SIMD_T)
| SIMD INTEGER SIZE. More...

## Typedefs
typedef void * | gim_alloc_function(size_t size)
| Function prototypes to allocate and free memory. More...
typedef void * | gim_alloca_function(size_t size)
typedef void * | gim_realloc_function(void *ptr, size_t oldsize, size_t newsize)
typedef void | gim_free_function(void *ptr)

## Functions
void | gim_set_alloc_handler (gim_alloc_function *fn)
| Memory Function Handlers set new memory management functions. More...
void | gim_set_alloca_handler (gim_alloca_function *fn)
void | gim_set_realloc_handler (gim_realloc_function *fn)
void | gim_set_free_handler (gim_free_function *fn)
gim_alloc_function * | gim_get_alloc_handler (void)
| get current memory management functions. More...
gim_alloca_function * | gim_get_alloca_handler (void)
gim_realloc_function * | gim_get_realloc_handler (void)
gim_free_function * | gim_get_free_handler (void)
void * | gim_alloc (size_t size)
| Standar Memory functions. More...
void * | gim_alloca (size_t size)
void * | gim_realloc (void *ptr, size_t oldsize, size_t newsize)
void | gim_free (void *ptr)
void | gim_simd_memcpy (void *dst, const void *src, size_t copysize)
template<class T >
void | gim_swap_elements (T *_array, size_t _i, size_t _j)
template<class T >
void | gim_swap_elements_memcpy (T *_array, size_t _i, size_t _j)
template<int SIZE>
void | gim_swap_elements_ptr (char *_array, size_t _i, size_t _j)

## Detailed Description

Author
  Francisco Leon Najera

Definition in file gim_memory.h.

## Macro Definition Documentation

## ◆ GIM_CONSTANT_ARRAY

#define GIM_CONSTANT_ARRAY | ( |  | array,
|  |  | element_count,
|  |  | constant
| ) |  |

Value:
{\
for (GUINT _i_=0;_i_<element_count ;++_i_)\
{\
array[_i_] = constant;\
}\
}\
GUINT
#define GUINT
Definition: gim_math.h:42

Definition at line 81 of file gim_memory.h.

## ◆ GIM_COPY_ARRAYS

#define GIM_COPY_ARRAYS | ( |  | dest_array,
|  |  | source_array,
|  |  | element_count
| ) |  |

Value:
{\
for (GUINT _i_=0;_i_<element_count ;++_i_)\
{\
dest_array[_i_] = source_array[_i_];\
}\
}\
GUINT
#define GUINT
Definition: gim_math.h:42

Functions for manip packed arrays of numbers.

Definition at line 56 of file gim_memory.h.

## ◆ GIM_COPY_ARRAYS_1

#define GIM_COPY_ARRAYS_1 | ( |  | dest_array,
|  |  | source_array,
|  |  | element_count,
|  |  | copy_macro
| ) |  |

Value:
{\
for (GUINT _i_=0;_i_<element_count ;++_i_)\
{\
copy_macro(dest_array[_i_],source_array[_i_]);\
}\
}\
GUINT
#define GUINT
Definition: gim_math.h:42

Definition at line 64 of file gim_memory.h.

## ◆ GIM_SIMD_MEMORY

#define GIM_SIMD_MEMORY 1

Definition at line 121 of file gim_memory.h.

## ◆ GIM_ZERO_ARRAY

#define GIM_ZERO_ARRAY | ( |  | array,
|  |  | element_count
| ) |  |

Value:
{\
for (GUINT _i_=0;_i_<element_count ;++_i_)\
{\
array[_i_] = 0;\
}\
}\
GUINT
#define GUINT
Definition: gim_math.h:42

Definition at line 73 of file gim_memory.h.

## ◆ pf

#define pf | ( |  | _x,
|  |  | _i
| ) |  |

Prefetch 64.

Definition at line 49 of file gim_memory.h.

## ◆ pf2

#define pf2 | ( |  | _x,
|  |  | _i
| ) |  |

Prefetch 128.

Definition at line 51 of file gim_memory.h.

## ◆ SIMD_T

#define SIMD_T GUINT64

SIMD POINTER INTEGER.

Definition at line 125 of file gim_memory.h.

## ◆ SIMD_T_SIZE

#define SIMD_T_SIZE sizeof(SIMD_T)

SIMD INTEGER SIZE.

Definition at line 127 of file gim_memory.h.

## Typedef Documentation

## ◆ gim_alloc_function

typedef void* gim_alloc_function(size_t size)

Function prototypes to allocate and free memory.

Definition at line 91 of file gim_memory.h.

## ◆ gim_alloca_function

typedef void* gim_alloca_function(size_t size)

Definition at line 92 of file gim_memory.h.

## ◆ gim_free_function

typedef void gim_free_function(void *ptr)

Definition at line 94 of file gim_memory.h.

## ◆ gim_realloc_function

typedef void* gim_realloc_function(void *ptr, size_t oldsize, size_t newsize)

Definition at line 93 of file gim_memory.h.

## Function Documentation

## ◆ gim_alloc()

void* gim_alloc | ( | size_t | size | ) |

Standar Memory functions.

Definition at line 86 of file gim_memory.cpp.

## ◆ gim_alloca()

void* gim_alloca | ( | size_t | size | ) |

Definition at line 104 of file gim_memory.cpp.

## ◆ gim_free()

void gim_free | ( | void * | ptr | ) |

Definition at line 119 of file gim_memory.cpp.

## ◆ gim_get_alloc_handler()

gim_alloc_function* gim_get_alloc_handler | ( | void |  | ) |

get current memory management functions.

Definition at line 63 of file gim_memory.cpp.

## ◆ gim_get_alloca_handler()

gim_alloca_function* gim_get_alloca_handler | ( | void |  | ) |

Definition at line 68 of file gim_memory.cpp.

## ◆ gim_get_free_handler()

gim_free_function* gim_get_free_handler | ( | void |  | ) |

Definition at line 80 of file gim_memory.cpp.

## ◆ gim_get_realloc_handler()

gim_realloc_function* gim_get_realloc_handler | ( | void |  | ) |

Definition at line 74 of file gim_memory.cpp.

## ◆ gim_realloc()

void* gim_realloc | ( | void * | ptr,
|  | size_t | oldsize,
|  | size_t | newsize
| ) |  |

Definition at line 110 of file gim_memory.cpp.

## ◆ gim_set_alloc_handler()

void gim_set_alloc_handler | ( | gim_alloc_function * | fn | ) |

Memory Function Handlers set new memory management functions.

if fn is 0, the default handlers are used.

Definition at line 43 of file gim_memory.cpp.

## ◆ gim_set_alloca_handler()

void gim_set_alloca_handler | ( | gim_alloca_function * | fn | ) |

Definition at line 48 of file gim_memory.cpp.

## ◆ gim_set_free_handler()

void gim_set_free_handler | ( | gim_free_function * | fn | ) |

Definition at line 58 of file gim_memory.cpp.

## ◆ gim_set_realloc_handler()

void gim_set_realloc_handler | ( | gim_realloc_function * | fn | ) |

Definition at line 53 of file gim_memory.cpp.

## ◆ gim_simd_memcpy()

void gim_simd_memcpy | ( | void * | dst,
|  | const void * | src,
|  | size_t | copysize
| ) |  |
| inline

Definition at line 130 of file gim_memory.h.

## ◆ gim_swap_elements()

template<class T >

void gim_swap_elements | ( | T * | _array,
|  | size_t | _i,
|  | size_t | _j
| ) |  |
| inline

Definition at line 162 of file gim_memory.h.

## ◆ gim_swap_elements_memcpy()

template<class T >

void gim_swap_elements_memcpy | ( | T * | _array,
|  | size_t | _i,
|  | size_t | _j
| ) |  |
| inline

Definition at line 171 of file gim_memory.h.

## ◆ gim_swap_elements_ptr()

template<int SIZE>

void gim_swap_elements_ptr | ( | char * | _array,
|  | size_t | _i,
|  | size_t | _j
| ) |  |
| inline

Definition at line 180 of file gim_memory.h.