Beispiel #1
0
 private void _Alloc_Init(int newlen)
 {
     AssocT[] ret = new AssocT[newlen];
     for (int init_from = 0; init_from < newlen; ++init_from)
     {
         ret[init_from].next  = init_from + 1;
         ret[init_from].value = default(T);
     }
     m_array = ret;
     m_len   = m_array.Length;
 }
Beispiel #2
0
        private void _Alloc_Normal(int newlen)
        {
            if (newlen < 0)
            {
                throw new OutOfMemoryException();
            }

            AssocT[] ret       = new AssocT[newlen];
            int      init_from = m_array.Length;

            m_head = init_from;
            Array.Copy(m_array, ret, init_from);

            for (; init_from < newlen; ++init_from)
            {
                ret[init_from].next  = init_from + 1;
                ret[init_from].value = default(T);
            }
            m_array = ret;
            m_len   = m_array.Length;
        }