Blk allocate(size_t n) {
   auto n1 = roundToAligned(n, align);
   if ((m_top - m_mem) + n1 > s) {
     return {nullptr, 0};
   }
   Blk r = {m_top, n};
   m_top += n1;
   return r;
 }
Beispiel #2
0
 AllocatorBlock allocate(size_t n) {
     auto n1 = roundToAligned(n);
     if (n1 > d_ + s - p_) {
         return {nullptr, 0};
     }
     AllocatorBlock result = {p_, n};
     p_ += n1;
     return result;
 }
 void deallocate(Blk blk) {
   if ((char *)blk.ptr + roundToAligned(blk.size, align) == m_top) {
     m_top = (char *)blk.ptr;
   }
 }
Beispiel #4
0
 void deallocate(AllocatorBlock b) {
     if ((char*)b.ptr + roundToAligned(b.length) == p_) {
         p_ = (char*)b.ptr;
     }
 }