Skip to content

Commit

Permalink
fixed net40 compile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Nov 6, 2019
1 parent 632a8eb commit 1c559f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace HandyControl.Controls
{
internal static class DoubleUtil
{
#if netle40
[MethodImpl(256)]
#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static bool IsNaN(this double value) => double.IsNaN(value);

public const double Epsilon = 2.2204460492503131E-16;
Expand All @@ -25,9 +29,17 @@ public static object GetBoxed(double value)
return value;
}

#if netle40
[MethodImpl(256)]
#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static bool IsCloseToZero(double value) => Math.Abs(value) < Epsilon;
#if netle40
[MethodImpl(256)]
#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static bool IsCloseToOne(double value) => Math.Abs(value - 1.0) < Epsilon;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,11 @@ public LayoutInfo(UIElement element)
}
}

#if netle40
[MethodImpl(256)]
#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static object GetBoxed(bool value) => value ? ValueBoxes.TrueBox : ValueBoxes.FalseBox;
}
}

0 comments on commit 1c559f9

Please sign in to comment.