ultimatepp/uppdev/NewCore/HeapImp.h
cxl 4a1c627474 Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

50 lines
981 B
C

#ifndef _NewCore_HeapImp_h_
#define _NewCore_HeapImp_h_
struct FreeLink {
FreeLink *next;
};
struct MPage {
byte klass;
byte freecount;
byte count;
byte filler;
int free;
FreeLink *freelist;
MPage *next;
MPage *prev;
#ifdef CPU_32
byte align32[12];
#endif
void LinkSelf() { prev = next = this; }
void Unlink() { prev->next = next; next->prev = prev; }
void Link(MPage *lnk) { prev = lnk; next = lnk->next; next->prev = this; lnk->next = this; }
void Format(int k);
};
struct MCache {
FreeLink *list;
int32 count;
};
extern
#ifdef flagMT
#ifdef COMPILER_MSC
__declspec(thread)
#else
__thread
#endif
#endif
MCache mcache[10];
void *MAlloc_Get(MCache& m, int k);
void MFree_Reduce(MCache& m, int k);
#define NKLASS 21
#define CACHEMAX 31
#define CACHERES (CACHEMAX / 2)
#endif