#include "RecastAssert.h"
#include <stdlib.h>
#include <stdint.h>
Go to the source code of this file.
◆ RC_SIZE_MAX
#define RC_SIZE_MAX INTPTR_MAX |
◆ rcLikely
#define rcLikely |
( |
|
x | ) |
(x) |
Macros to hint to the compiler about the likeliest branch.
Please add a benchmark that demonstrates a performance improvement before introducing use cases.
◆ rcUnlikely
#define rcUnlikely |
( |
|
x | ) |
(x) |
◆ rcAllocFunc
typedef void*() rcAllocFunc(size_t size, rcAllocHint hint) |
◆ rcFreeFunc
typedef void() rcFreeFunc(void *ptr) |
A memory deallocation function.
- Parameters
-
[in] | ptr | A pointer to a memory block previously allocated using rcAllocFunc. |
- See also
- rcAllocSetCustom
◆ rcSizeType
Signed to avoid warnings when comparing to int loop indexes, and common error with comparing to zero.
MSVC2010 has a bug where ssize_t is unsigned (!!!).
◆ rcAllocHint
Provides hint values to the memory allocator on how long the memory is expected to be used.
Enumerator |
---|
RC_ALLOC_PERM | Memory will persist after a function call.
|
RC_ALLOC_TEMP | Memory used temporarily within a function.
|
◆ operator delete()
void operator delete |
( |
void * |
, |
|
|
const rcNewTag & |
, |
|
|
void * |
|
|
) |
| |
|
inline |
◆ operator new()
void* operator new |
( |
size_t |
, |
|
|
const rcNewTag & |
, |
|
|
void * |
p |
|
) |
| |
|
inline |
◆ rcAlloc()
Allocates a memory block.
- Parameters
-
[in] | size | The size, in bytes of memory, to allocate. |
[in] | hint | A hint to the allocator on how long the memory is expected to be in use. |
- Returns
- A pointer to the beginning of the allocated memory block, or null if the allocation failed.
- See also
- rcFree, rcAllocSetCustom
◆ rcAllocSetCustom()
Sets the base custom allocation functions to be used by Recast.
- Parameters
-
[in] | allocFunc | The memory allocation function to be used by rcAlloc |
[in] | freeFunc | The memory de-allocation function to be used by rcFree |
- See also
- rcAlloc, rcFree
◆ rcFree()
void rcFree |
( |
void * |
ptr | ) |
|
Deallocates a memory block.
If ptr
is NULL, this does nothing.
- Warning
- This function leaves the value of
ptr
unchanged. So it still points to the same (now invalid) location, and not to null.
- Parameters
-
[in] | ptr | A pointer to a memory block previously allocated using rcAlloc. |
- See also
- rcAlloc, rcAllocSetCustom