Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 11, 2025

🚀 Solution Summary

This PR fixes issue #106 by replacing hardcoded 32 values with the BitsSize field in the Bit<T> class methods.

📋 Issue Reference

Fixes #106

🔧 Changes Made

  • File: csharp/Platform.Numbers/Bit[T].cs
  • Method: PartialWrite - Lines 29 and 33
    • Changed shift = 32 + shift; to shift = BitsSize + shift;
    • Changed limit = 32 + limit; to limit = BitsSize + limit;
  • Method: PartialRead - Lines 43 and 47
    • Changed shift = 32 + shift; to shift = BitsSize + shift;
    • Changed limit = 32 + limit; to limit = BitsSize + limit;

✅ Verification

  • Build: Solution compiles successfully
  • Tests: All 7 tests pass (0 failed, 0 skipped)
  • Code Quality: No breaking changes, maintains existing functionality

📖 Technical Details

The BitsSize field is already defined in the class as:

private static int BitsSize = NumericType<T>.BitsSize;

This change makes the bit operations generic and work correctly for different numeric types (not just 32-bit integers), which aligns with the generic nature of the Bit<T> class.

🧪 Test Results

Passed!  - Failed: 0, Passed: 7, Skipped: 0, Total: 7

🤖 This solution was implemented automatically by the AI issue solver

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

Issue: #106
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 12:17
- Replace hardcoded 32 values with BitsSize field in PartialWrite and PartialRead methods
- This makes the code generic and work correctly for different numeric types
- All tests pass after the change

Fixes #106

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Replace 32 with BitsSize Replace 32 with BitsSize in Bit<T> methods Sep 11, 2025
@konard konard marked this pull request as ready for review September 11, 2025 09:23
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.

Replace 32 with BitsSize

2 participants