integration/gwnavruntimeglue/bulletcollisioninterface/customallocator.h Source File

customallocator.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 #ifndef KyRuntimeGlue_CustomAllocator_H
9 #define KyRuntimeGlue_CustomAllocator_H
10 
11 KY_INLINE void* CustomAlignedAlloc(size_t size, int alignment)
12 {
13  if (size == 0)
14  return KY_NULL;
15 
16  return KY_MEMALIGN(size, alignment, Kaim::MemStat_World_Other);
17 }
18 
19 KY_INLINE void CustomAlignedFreeFunc(void* memblock)
20 {
21  if (memblock)
22  KY_FREE_ALIGN(memblock);
23 }
24 
25 KY_INLINE void* CustomAllocFunc(size_t size)
26 {
27  if (size == 0)
28  return KY_NULL;
29 
30  return KY_ALLOC(size, Kaim::MemStat_World_Other);
31 }
32 
33 KY_INLINE void CustomFreeFunc(void* memblock)
34 {
35  if (memblock)
36  KY_FREE(memblock);
37 }
38 
39 #endif // KyRuntimeGlue_CustomAllocator_H
#define KY_NULL
Null value.
Definition: types.h:247