SpaceCadetPinball/SpaceCadetPinball/memory.h

22 lines
501 B
C
Raw Normal View History

2020-11-05 16:44:34 +01:00
#pragma once
class memory
{
public:
static void init(void (*callback)(void));
static char* allocate(unsigned int size);
static void free(void* buf);
static char* realloc(void* buf, unsigned int size);
static unsigned int use_total;
static int critical_allocation;
static void (*critical_callback)();
};
2020-11-14 16:13:00 +01:00
// Fill memory block with an integer value
inline void memset32(void* ptr, unsigned int value, int count)
{
auto p = (unsigned int*)ptr;
for (int i = 0; i < count; i++)
*p++ = value;
}