Esempio n. 1
0
 /// <summary>
 /// Resolves a binary arithmetic operation.
 /// </summary>
 /// <param name="kind">The arithmetic kind.</param>
 /// <param name="isFloat">True, if this is a floating-point operation.</param>
 /// <param name="isFunction">True, if the resolved operation is a function call.</param>
 /// <returns>The resolved arithmetic operation.</returns>
 public static string GetArithmeticOperation(
     BinaryArithmeticKind kind,
     bool isFloat,
     out bool isFunction)
 {
     if (!BinaryArithmeticOperations.TryGetValue((kind, isFloat), out var operation))
     {
         throw new NotSupportedIntrinsicException(kind.ToString());
     }
     isFunction = operation.Item2;
     return(operation.Item1);
 }
Esempio n. 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());
        }