r5sdk/r5dev/tier0/tslist.cpp
Kawe Mazidjatari 8acfad5556 Fix aligned memalloc singleton
Properly fix the aligned memalloc singleton in the SDK; the implementation now uses a callback based approach for calling the allocator and deallocator.
2023-05-15 20:47:17 +02:00

29 lines
963 B
C++

//=============================================================================//
//
// Purpose:
//
//=============================================================================//
#include "tier0/tslist.h"
//-----------------------------------------------------------------------------
// Purpose: alloc aligned memory
// Input : nSize -
// nPad -
// Output : pointer to allocated aligned memory
//-----------------------------------------------------------------------------
void* CAlignedMemAlloc::Alloc(size_t nSize, size_t nAlignment)
{
return ((void* (*)(size_t, size_t))m_pAllocCallback)(nSize, nAlignment);
}
//-----------------------------------------------------------------------------
// Purpose: free aligned memory
// Input : pMem -
//-----------------------------------------------------------------------------
void CAlignedMemAlloc::Free(void* pMem)
{
((void (*)(void*))m_pFreeCallback)(pMem);
}
CAlignedMemAlloc* g_pAlignedMemAlloc;