示例#1
0
        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);
        }
示例#2
0
 public void Multiply(InterpreterResult operand)
 {
     if (DataType == ScriptDataType.Float)
     {
         this.Float = this.GetFloat() * operand.GetFloat();
     }
     else
     {
         this.Short = (short)(this.GetShort() * operand.GetShort());
     }
 }
示例#3
0
        private static float Difference(InterpreterResult left, InterpreterResult right)
        {
            Debug.Assert(left.DataType == ScriptDataType.Float);

            return(left.Float - right.GetFloat());
        }
示例#4
0
        public static InterpreterResult Max(InterpreterResult left, InterpreterResult right)
        {
            Debug.Assert(left.DataType == ScriptDataType.Float);

            return(Difference(left, right) < 0 ? right : left);
        }
示例#5
0
 public void Reset()
 {
     this.TopOfStack = -1;
     this.Yield      = false;
     this.Result     = InterpreterResult.From();
 }