예제 #1
0
        public static string GetArithmeticOperation(
            BinaryArithmeticKind kind,
            ArithmeticBasicValueType type,
            bool fastMath)
        {
            var key = (kind, type);

            if (fastMath &&
                BinaryArithmeticOperationsFastMath.TryGetValue(key, out string operation))
            {
                return(operation);
            }
            return(BinaryArithmeticOperations[key]);
        }
예제 #2
0
        /// <summary>
        /// Resolves a binary 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(
            BinaryArithmeticKind kind,
            ArithmeticBasicValueType type,
            bool fastMath)
        {
            var key = (kind, type);

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