Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always inline number conversions #112061

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Decimal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,7 @@ static bool INumberBase<decimal>.TryConvertFromTruncating<TOther>(TOther value,
return TryConvertFrom(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertFrom<TOther>(TOther value, out decimal result)
where TOther : INumberBase<TOther>
{
Expand Down Expand Up @@ -1722,6 +1723,7 @@ static bool INumberBase<decimal>.TryConvertToTruncating<TOther>(decimal value, [
return TryConvertTo(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertTo<TOther>(decimal value, [MaybeNullWhen(false)] out TOther result)
where TOther : INumberBase<TOther>
{
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Double.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@ static bool INumberBase<double>.TryConvertFromTruncating<TOther>(TOther value, o
return TryConvertFrom(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertFrom<TOther>(TOther value, out double result)
where TOther : INumberBase<TOther>
{
Expand Down Expand Up @@ -1378,6 +1379,7 @@ static bool INumberBase<double>.TryConvertToTruncating<TOther>(double value, [Ma
return TryConvertTo(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertTo<TOther>(double value, [MaybeNullWhen(false)] out TOther result)
where TOther : INumberBase<TOther>
{
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Half.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,7 @@ static bool INumberBase<Half>.TryConvertFromTruncating<TOther>(TOther value, out
return TryConvertFrom(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertFrom<TOther>(TOther value, out Half result)
where TOther : INumberBase<TOther>
{
Expand Down Expand Up @@ -2077,6 +2078,7 @@ static bool INumberBase<Half>.TryConvertToTruncating<TOther>(Half value, [MaybeN
return TryConvertTo(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertTo<TOther>(Half value, [MaybeNullWhen(false)] out TOther result)
where TOther : INumberBase<TOther>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ static bool INumberBase<NFloat>.TryConvertFromTruncating<TOther>(TOther value, o
return TryConvertFrom(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertFrom<TOther>(TOther value, out NFloat result)
where TOther : INumberBase<TOther>
{
Expand Down Expand Up @@ -1649,6 +1650,7 @@ static bool INumberBase<NFloat>.TryConvertToTruncating<TOther>(NFloat value, [Ma
return TryConvertTo(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertTo<TOther>(NFloat value, [MaybeNullWhen(false)] out TOther result)
where TOther : INumberBase<TOther>
{
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/Single.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ static bool INumberBase<float>.TryConvertFromTruncating<TOther>(TOther value, ou
return TryConvertFrom(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertFrom<TOther>(TOther value, out float result)
where TOther : INumberBase<TOther>
{
Expand Down Expand Up @@ -1397,6 +1398,7 @@ static bool INumberBase<float>.TryConvertToTruncating<TOther>(float value, [Mayb
return TryConvertTo(value, out result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryConvertTo<TOther>(float value, [MaybeNullWhen(false)] out TOther result)
where TOther : INumberBase<TOther>
{
Expand Down
Loading