Skip to content

Replace Platform.Numbers library with .NET 8 generic math#49

Open
konard wants to merge 3 commits intomainfrom
issue-46-9e397f50
Open

Replace Platform.Numbers library with .NET 8 generic math#49
konard wants to merge 3 commits intomainfrom
issue-46-9e397f50

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Sep 11, 2025

Summary

This PR implements issue #46 by replacing the Platform.Numbers library with .NET 8 generic math capabilities.

Changes Made

  • Replaced Platform.Numbers.Arithmetic.Increment with .NET 8 generic math operators (+= with TLinkAddress.One)
  • Updated generic constraints to use INumber<TLinkAddress> instead of just struct
  • Updated imports to use System.Numerics instead of Platform.Numbers
  • Applied changes to all relevant classes:
    • DefaultJsonStorage<TLinkAddress>
    • JsonImporterCli<TLinkAddress>
    • JsonExporterCli<TLinkAddress>

Breaking Changes

  • Version bumped to 0.2.0 due to breaking changes in generic constraints
  • Classes using DefaultJsonStorage now require TLinkAddress types that implement INumber<TLinkAddress>
  • This is compatible with standard numeric types (uint, ulong, etc.) used in the platform

Benefits

  • Reduced dependency footprint - No longer directly depends on Platform.Numbers
  • Better performance - Uses optimized .NET generic math operations
  • Future-proof - Leverages modern .NET features
  • Type safety - Stronger compile-time guarantees for numeric operations

Testing

  • All projects build successfully
  • No breaking changes for existing usage with standard numeric types
  • Platform.Numbers is still available transitively from other dependencies if needed

Fixes #46

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #46
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 09:26
- Replace Arithmetic.Increment with INumber<T> constraint and generic math operators
- Update DefaultJsonStorage to use INumber<TLinkAddress> constraint
- Update CLI classes to include INumber constraint
- Bump version to 0.2.0 to reflect breaking change
- Remove direct dependency on Platform.Numbers (still transitive from other packages)

Fixes #46

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Use .NET 7 Generic math instead of Platform.Numbers library Replace Platform.Numbers library with .NET 8 generic math Sep 11, 2025
@konard konard marked this pull request as ready for review September 11, 2025 06:37
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.

Use .NET 7 Generic math instead of Platform.Numbers library

1 participant