protected static void _memcopy_rc(byte* dst, RefCountPtr* src, int cnt) { var ss = (byte*)(src + 1); if (cnt <= iBigBlockSize) _memcopy(dst, ss, cnt); else { _memcopy(dst, ss, iBigBlockSize); _memcopy_rc(dst + iBigBlockSize, src->Next, cnt - iBigBlockSize); } }
protected static void _dbkcopy(RefCountPtr* rc, byte* src, int cnt) { var ds = (byte*)(rc + 1); if (cnt <= iBigBlockSize) _memcopy(ds, src, cnt); else { _memcopy(ds, src, iBigBlockSize); _dbkcopy(rc->Next, src + iBigBlockSize, cnt - iBigBlockSize); } }
protected static void _memcopy(byte[] dst, RefCountPtr* src, int cnt) { if (cnt < 32) { var ss = (byte*)(src + 1); for (int i = 0; i < cnt; i++) dst[i] = *ss++; return; } fixed (byte* ds = dst) _memcopy_rc(ds, src, cnt); }
protected static byte* _skip(RefCountPtr* bp, int skip) { return (byte*)(bp + 1) + skip; }
public void Set(RefCountPtr* ls, int cnt) { next = ls; count = cnt; }
public void Push(RefCountPtr* bp) { bp->_list = next; next = bp; count++; }
private void FreeMem(RefCountPtr* bp, int size) { if (size <= iLastSlabSize) _slabs[_slab_id(size + SizeofRcp)].Push(bp); else { var ls = bp->Next; bp->_list = _sbigs; _sbigs = bp; _cntBigs++; if (ls == null) return; for (_cntBigs++, bp = ls; bp->_list != null; bp = bp->_list) _cntBigs++; bp->_list = _sbigs; _sbigs = ls; } }