mame/src/emu/netlist/plib/palloc.c
couriersud 3011b4b068 Moved nltool.c and nlwav.c into src/emu/netlist/prg.
Added src/emu/netlist/build/makefile. This allows netlist to be ripped
out of the tree and to compile it standalone. (nw)
2015-08-23 20:59:07 +02:00

59 lines
936 B
C

// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* palloc.c
*
*/
#include <cstdio>
#include "pconfig.h"
#include "palloc.h"
//============================================================
// Exceptions
//============================================================
pexception::pexception(const pstring &text)
{
m_text = text;
fprintf(stderr, "%s\n", m_text.cstr());
}
#if (PSTANDALONE)
#include <stdlib.h>
#include <xmmintrin.h>
class pmemory_pool
{
public:
pmemory_pool() {}
};
static pmemory_pool sppool;
pmemory_pool *ppool = &sppool;
void* operator new(std::size_t size, pmemory_pool *pool) throw (std::bad_alloc)
{
//printf("here new\n");
return palloc_raw(size);;
}
void operator delete(void *ptr, pmemory_pool *pool)
{
//printf("here delete\n");
if (ptr != NULL)
pfree_raw(ptr);
}
void *palloc_raw(const size_t size)
{
return _mm_malloc(size, 64);
}
void pfree_raw(void *p)
{
_mm_free(p);
}
#endif