12345678910111213141516171819202122232425262728293031323334 |
- #ifndef CORE_UTILITY_H
- #define CORE_UTILITY_H
- #include "core/Check.h"
- #include "core/Types.h"
- size_t corePopCount(u64 u);
- typedef void (*CoreExitHandler)(int, void*);
- void coreExitWithHandler(const char* file, int line, int value);
- void coreSetExitHandler(CoreExitHandler h, void* data);
- #define CORE_EXIT(exitValue) coreExitWithHandler(__FILE__, __LINE__, exitValue)
- typedef void (*CoreOutOfMemoryHandler)(void*);
- void coreSetOutOfMemoryHandler(CoreOutOfMemoryHandler h, void* data);
- #ifdef CORE_CHECK_MEMORY
- void* coreDebugAllocate(const char* file, int line, size_t n);
- void* coreDebugReallocate(const char* file, int line, void* p, size_t n);
- void coreFreeDebug(const char* file, int line, void* p);
- void corePrintMemoryReport();
- #define coreAllocate(n) coreDebugAllocate(__FILE__, __LINE__, n)
- #define coreReallocate(p, n) coreDebugReallocate(__FILE__, __LINE__, p, n)
- #define coreFree(p) coreFreeDebug(__FILE__, __LINE__, p)
- #else
- void* coreAllocate(size_t n);
- void* coreReallocate(void* p, size_t n);
- void coreFree(void* p);
- #define corePrintMemoryReport()
- #endif
- #endif
|