public ITransientVector pop()
{
EnsureEditable();
if (_cnt == 0)
throw new InvalidOperationException("Can't pop empty vector");
if (_cnt == 1)
{
_cnt = 0;
return this;
}
int i = _cnt - 1;
// pop in tail?
if ((i & 0x01f) > 0)
{
--_cnt;
return this;
}
object[] newtail = EditableArrayFor(_cnt - 2);
Node newroot = PopTail(_shift, _root);
int newshift = _shift;
if (newroot == null)
{
newroot = new Node(_root.Edit);
}
if (_shift > 5 && newroot.Array[1] == null)
{
newroot = EnsureEditable((Node)newroot.Array[0]);
newshift -= 5;
}
_root = newroot;
_shift = newshift;
--_cnt;
_tail = newtail;
return this;
}