Skip to content

Csharp/feature/use generic math#122

Merged
FreePhoenix888 merged 7 commits intomainfrom
csharp/feature/use_generic_math
Dec 28, 2022
Merged

Csharp/feature/use generic math#122
FreePhoenix888 merged 7 commits intomainfrom
csharp/feature/use_generic_math

Conversation

@FreePhoenix888
Copy link
Copy Markdown
Member

No description provided.

Comment thread csharp/Platform.Data.Tests/LinksConstantsTests.cs Outdated
Comment on lines 48 to 49
var converter = UncheckedConverter<TSigned, TUnsigned>.Default;
var half = converter.Convert(NumericType<TSigned>.MaxValue);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make generic conversions in .NET 7, converters may be slower than native conversion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

NumericType<TUnsigned>.MaxValue / 2

?

Copy link
Copy Markdown
Member

@konard konard Dec 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FreePhoenix888 division is slow, we already have required value in NumericType<TSigned>.MaxValue

@FreePhoenix888 FreePhoenix888 merged commit 699a67d into main Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants