コード例 #1
0
        private static Operand EmitRoundMathCall(ArmEmitterContext context, MidpointRounding roundMode, Operand n)
        {
            IOpCode32Simd op = (IOpCode32Simd)context.CurrOp;

            string name = nameof(Math.Round);

            MethodInfo info = (op.Size & 1) == 0
                ? typeof(MathF).GetMethod(name, new Type[] { typeof(float), typeof(MidpointRounding) })
                : typeof(Math).GetMethod(name, new Type[] { typeof(double), typeof(MidpointRounding) });

            return(context.Call(info, n, Const((int)roundMode)));
        }
コード例 #2
0
        public static Operand EmitRoundMathCall(ArmEmitterContext context, MidpointRounding roundMode, Operand n)
        {
            IOpCode32Simd op = (IOpCode32Simd)context.CurrOp;

            Delegate dlg;

            if ((op.Size & 1) == 0)
            {
                dlg = new _F32_F32_MidpointRounding(MathF.Round);
            }
            else /* if ((op.Size & 1) == 1) */
            {
                dlg = new _F64_F64_MidpointRounding(Math.Round);
            }

            return(context.Call(dlg, n, Const((int)roundMode)));
        }