/// <summary> /// Resolves a compare operation. /// </summary> /// <param name="kind">The compare kind.</param> /// <param name="flags">The compare flags.</param> /// <param name="type">The type to compare.</param> /// <returns>The resolved compare operation.</returns> public static string GetCompareOperation( CompareKind kind, CompareFlags flags, ArithmeticBasicValueType type) { var unorderedFloatComparison = type.IsFloat() && flags.HasFlag(CompareFlags.UnsignedOrUnordered); if (unorderedFloatComparison) { if (CompareUnorderedFloatOperations.TryGetValue( (kind, type), out string operation)) { return(operation); } } else { if (CompareOperations.TryGetValue((kind, type), out string operation)) { return(operation); } } throw new NotSupportedIntrinsicException(kind.ToString()); }
public int Compare(Object x, Object y) { // Compare two Error Records. The comparison kind determines which // field of the Error Record to perform the comparison on. switch(m_Kind) { case (CompareKind.Path): { return (((ErrorRecord) x).Path.CompareTo(((ErrorRecord)(y)).Path); break; } case (CompareKind.Message): { return (((ErrorRecord) x).Message.CompareTo(((ErrorRecord) y).Message); break; } default: { Debug.Fail("Unexpected compare kind: " + m_Kind.ToString(); break; } } }
/// <summary> /// Resolves a compare operation. /// </summary> /// <param name="kind">The compare kind.</param> /// <param name="type">The type to compare.</param> /// <returns>The resolved compare operation.</returns> public static string GetCompareOperation(CompareKind kind, ArithmeticBasicValueType type) { if (CompareOperations.TryGetValue((kind, type), out string operation)) { return(operation); } throw new NotSupportedIntrinsicException(kind.ToString()); }