source: proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fixedsizeheap.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 416 bytes
Line 
1#ifndef _FIXEDSIZEHEAP_H_
2#define _FIXEDSIZEHEAP_H_
3
4
5template <class SH, int Size>
6class FixedSizeHeap : public SH {
7public:
8  inline void * malloc (size_t sz) {
9    assert (sz <= Size);
10    //printf ("malloc\n");
11    return SH::malloc (Size);
12  }
13  inline void free (void * ptr) {
14    //printf ("free\n");
15    SH::free (ptr);
16  }
17protected:
18  inline static size_t size (void * p) {
19    return Size;
20  }
21};
22
23#endif
Note: See TracBrowser for help on using the repository browser.