Ejemplo n.º 1
0
        private static Expression BigIntConstant(BigInt value)
        {
            int ival;

            if (value.AsInt32(out ival))
            {
                return(Expression.Call(
                           new Func <int, BigInt>(CompilerHelpers.CreateBigInt).GetMethodInfo(),
                           Constant(ival)
                           ));
            }

            long lval;

            if (value.AsInt64(out lval))
            {
                return(Expression.Call(
                           new Func <long, BigInt>(CompilerHelpers.CreateBigInt).GetMethodInfo(),
                           Constant(lval)
                           ));
            }

            return(Expression.Call(
                       new Func <bool, byte[], BigInt>(CompilerHelpers.CreateBigInt).GetMethodInfo(),
                       Constant(value.Sign < 0),
                       CreateArray <byte>(value.Abs().ToByteArray())
                       ));
        }