Ejemplo n.º 1
0
        protected override void Compile(CodeContext c)
        {
            var val  = c.Int32("val");
            var skip = c.Label();

            c.SetArgument(0, val);

            c.Cmp(val, 1);
            c.Jle(skip);

            var tmp = c.Int32("tmp");

            c.Mov(tmp, val);
            c.Dec(tmp);

            var call = c.Call(c.Entry);

            call.SetArgument(0, tmp);
            call.SetReturn(0, tmp);
            c.Mul(c.Int32(), val, tmp);

            c.Bind(skip);
            c.Ret(val);
        }