Esempio n. 1
0
        public static string GetArithmeticOperation(
            UnaryArithmeticKind kind,
            ArithmeticBasicValueType type,
            bool fastMath)
        {
            var key = (kind, type);

            if (fastMath &&
                UnaryArithmeticOperationsFastMath.TryGetValue(key, out string operation))
            {
                return(operation);
            }
            return(UnaryArithmeticOperations[key]);
        }
Esempio n. 2
0
        /// <summary>
        /// Resolves an unary arithmetic operation.
        /// </summary>
        /// <param name="kind">The arithmetic kind.</param>
        /// <param name="type">The operation type.</param>
        /// <param name="fastMath">True, to use a fast-math operation.</param>
        /// <returns>The resolved arithmetic operation.</returns>
        public static string GetArithmeticOperation(
            UnaryArithmeticKind kind,
            ArithmeticBasicValueType type,
            bool fastMath)
        {
            var key = (kind, type);

            if (fastMath &&
                UnaryArithmeticOperationsFastMath.TryGetValue(key, out string operation) ||
                UnaryArithmeticOperations.TryGetValue(key, out operation))
            {
                return(operation);
            }
            throw new NotSupportedIntrinsicException(kind.ToString());
        }