Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SimplePromotableType simplified, returns true if src is int-type and …
…destination type is float or double, leaving overflow checking entirely to the conversion routine
  • Loading branch information
sigbjorn committed Jul 23, 2016
commit bdbaa626a496354d1eaf2f5f2d6739f4dbe627b9
7 changes: 4 additions & 3 deletions src/runtime/methodbinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,16 @@ internal Binding Bind(IntPtr inst, IntPtr args, IntPtr kw,
}
/// <summary>
/// Returns true if src type (int -type) is promotable to a higher resolution type (float|double)
/// <note>no sanity check for overflow is done, this is done elsewhere when performing
/// the actual conversion.
/// </note>
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
/// <returns></returns>
private bool SimplePromotableType(Type src, Type dst)
{
return (((src == typeof(int) || src == typeof(short)) && (dst == typeof(double) || dst == typeof(float))))
|| ((src == typeof(long)) && (dst == typeof(double)))
|| ((src ==typeof(int) || src == typeof(short)) && (dst == typeof(long)));
return (((src == typeof(int) || src == typeof(short) || src == typeof(long) ) && (dst == typeof(double) || dst == typeof(float))));
}

internal virtual IntPtr Invoke(IntPtr inst, IntPtr args, IntPtr kw)
Expand Down