Jurassic.Compiler.DynamicILGenerator.LoadInt32 C# (CSharp) Method

LoadInt32() public method

Pushes a constant value onto the stack.
public LoadInt32 ( int value ) : void
value int The integer to push onto the stack.
return void
        public override void LoadInt32(int value)
        {
            if (value >= -1 && value <= 8)
            {
                // ldc.i4.m1 = 15
                // ldc.i4.0 = 16
                // ldc.i4.1 = 17
                // ldc.i4.2 = 18
                // ldc.i4.3 = 19
                // ldc.i4.4 = 1A
                // ldc.i4.5 = 1B
                // ldc.i4.6 = 1C
                // ldc.i4.7 = 1D
                // ldc.i4.8 = 1E
                Emit1ByteOpCode((byte)(0x16 + value), 0, 1);
            }
            else if (value >= -128 && value <= 127)
            {
                // ldc.i4.s value = 1F <unsigned int8>
                Emit1ByteOpCodeInt8(0x1F, 0, 1, value);
            }
            else
            {
                // ldc.i4 value = 20 <int32>
                Emit1ByteOpCodeInt32(0x20, 0, 1, value);
            }

            // The instruction pushes a value onto the stack.
            PushStackOperand(VESType.Int32);
        }
DynamicILGenerator