public override object Invoke(CppResolver resolver, object lhs, object rhs) { if (lhs == null && rhs == null) { return(!Negate); // ==: true; !=: false } if (lhs == null || rhs == null) { return(Negate); // ==: false; !=: true } lhs = resolver.CSharpPrimitiveCast(Type, lhs); rhs = resolver.CSharpPrimitiveCast(Type, rhs); bool equal; if (Type == TypeCode.Single) { equal = (float)lhs == (float)rhs; } else if (Type == TypeCode.Double) { equal = (double)lhs == (double)rhs; } else { equal = object.Equals(lhs, rhs); } return(equal ^ Negate); }
public override object Invoke(CppResolver resolver, object lhs, object rhs) { if (lhs == null || rhs == null) { return(null); } return(func((T1)resolver.CSharpPrimitiveCast(Type.GetTypeCode(typeof(T1)), lhs), (T2)resolver.CSharpPrimitiveCast(Type.GetTypeCode(typeof(T2)), rhs))); }
public override object Invoke(CppResolver resolver, object lhs, object rhs) { if (lhs == null || rhs == null) { return(null); } Func <T1, T2, T1> func = resolver.CheckForOverflow ? checkedFunc : uncheckedFunc; return(func((T1)resolver.CSharpPrimitiveCast(Type.GetTypeCode(typeof(T1)), lhs), (T2)resolver.CSharpPrimitiveCast(Type.GetTypeCode(typeof(T2)), rhs))); }
public override object Invoke(CppResolver resolver, object input) { if (input == null) { return(null); } return(func((T)resolver.CSharpPrimitiveCast(Type.GetTypeCode(typeof(T)), input))); }