public void Push(int value) { var oldFirst = first; first = (ValueNode *)(Marshal.AllocHGlobal(sizeof(ValueNode))); first->Value = value; first->Next = oldFirst; }
public void Push(int value) { var oldFirst = first; first = &data[Count++]; first->Value = value; first->Next = oldFirst; }
public PoolBasedValueStack(ValueNode *allocated) { data = allocated; first = allocated; }
public unsafe void Bootstrap() { _data = Enumerable.Range(0, this.Count).Select(x => new Node()).ToArray(); _allocated = (ValueNode *)Marshal.AllocHGlobal(sizeof(ValueNode) * (this.Count + 1)).ToPointer(); RuntimeHelpers.PrepareMethod(typeof(Stack).GetMethod("Push", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).MethodHandle); }