public static InterpreterState Create(int nodeIndex) { var s = new InterpreterState(); s.OriginalNodeIndex = nodeIndex; s.TopOfStack = -1; s.CallStack = new StackFrame[32]; s.Result = InterpreterResult.From(); return(s); }
public void Multiply(InterpreterResult operand) { if (DataType == ScriptDataType.Float) { this.Float = this.GetFloat() * operand.GetFloat(); } else { this.Short = (short)(this.GetShort() * operand.GetShort()); } }
private static float Difference(InterpreterResult left, InterpreterResult right) { Debug.Assert(left.DataType == ScriptDataType.Float); return(left.Float - right.GetFloat()); }
public static InterpreterResult Max(InterpreterResult left, InterpreterResult right) { Debug.Assert(left.DataType == ScriptDataType.Float); return(Difference(left, right) < 0 ? right : left); }
public void Reset() { this.TopOfStack = -1; this.Yield = false; this.Result = InterpreterResult.From(); }