From ec61146d1a4d2dfaeb17856ced4f55cf61221ba3 Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 12:17:30 +0300 Subject: [PATCH 1/5] Initial commit with task details for issue #106 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Numbers/issues/106 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..9eaca6f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Numbers/issues/106 +Your prepared branch: issue-106-48d2da31 +Your prepared working directory: /tmp/gh-issue-solver-1757582242181 + +Proceed. \ No newline at end of file From 00700777791bc7b71f21ff4308edd4b4b2d9d97c Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 12:17:49 +0300 Subject: [PATCH 2/5] Remove CLAUDE.md - PR created successfully --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 9eaca6f..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Numbers/issues/106 -Your prepared branch: issue-106-48d2da31 -Your prepared working directory: /tmp/gh-issue-solver-1757582242181 - -Proceed. \ No newline at end of file From abd1db7720a4764af4ae83e82d5bd77655ac7a6c Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 12:22:49 +0300 Subject: [PATCH 3/5] Replace hardcoded 32 with BitsSize in Bit methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- csharp/Platform.Numbers/Bit[T].cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/csharp/Platform.Numbers/Bit[T].cs b/csharp/Platform.Numbers/Bit[T].cs index 8e8b752..ec6ee07 100644 --- a/csharp/Platform.Numbers/Bit[T].cs +++ b/csharp/Platform.Numbers/Bit[T].cs @@ -26,11 +26,11 @@ public static T PartialWrite(T target, T source, int shift, int limit) { if (shift < 0) { - shift = 32 + shift; + shift = BitsSize + shift; } if (limit < 0) { - limit = 32 + limit; + limit = BitsSize + limit; } var sourceMask = ~(T.MaxValue << limit) & T.MaxValue; var targetMask = ~(sourceMask << shift); @@ -40,11 +40,11 @@ public static T PartialRead(T target, int shift, int limit) { if (shift < 0) { - shift = 32 + shift; + shift = BitsSize + shift; } if (limit < 0) { - limit = 32 + limit; + limit = BitsSize + limit; } var sourceMask = ~(T.MaxValue << limit) & T.MaxValue; var targetMask = sourceMask << shift; From d29a1824acedb8e5f87215b9836eb1a28f0d60d4 Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 14 Apr 2026 13:04:08 +0000 Subject: [PATCH 4/5] Replace hardcoded 8 with CHAR_BIT in C++ Bit methods Similarly to the C# fix (replacing 32 with BitsSize), replace the hardcoded magic number 8 with CHAR_BIT from in the C++ PartialWrite and PartialRead template functions, making the bit size calculation explicit and portable. Co-Authored-By: Claude Sonnet 4.6 --- cpp/Platform.Numbers/Bit.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/Platform.Numbers/Bit.h b/cpp/Platform.Numbers/Bit.h index e210a04..a351734 100644 --- a/cpp/Platform.Numbers/Bit.h +++ b/cpp/Platform.Numbers/Bit.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include namespace Platform::Numbers::Bit @@ -59,11 +60,11 @@ namespace Platform::Numbers::Bit { if (shift < 0) { - shift = sizeof(T) * 8 + shift; + shift = sizeof(T) * CHAR_BIT + shift; } if (limit < 0) { - limit = sizeof(T) * 8 + limit; + limit = sizeof(T) * CHAR_BIT + limit; } auto sourceMask = ~(std::numeric_limits::max() << limit) & std::numeric_limits::max(); auto targetMask = ~(sourceMask << shift); @@ -75,11 +76,11 @@ namespace Platform::Numbers::Bit { if (shift < 0) { - shift = sizeof(T) * 8 + shift; + shift = sizeof(T) * CHAR_BIT + shift; } if (limit < 0) { - limit = sizeof(T) * 8 + limit; + limit = sizeof(T) * CHAR_BIT + limit; } auto sourceMask = ~(std::numeric_limits::max() << limit) & std::numeric_limits::max(); auto targetMask = sourceMask << shift; From 023a2f517b3d44d37b166e72b0aaad6c8497a3d1 Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 14 Apr 2026 13:08:13 +0000 Subject: [PATCH 5/5] Fix Codacy warning: replace /CHAR_BIT with std::numeric_limits Remove `#include ` which Cppcheck flagged as "Include file not found" in Codacy Static Code Analysis. Replace `CHAR_BIT` with `std::numeric_limits::digits` from `` (already included), which is semantically equivalent and avoids the missing-include warning. Co-Authored-By: Claude Sonnet 4.6 --- cpp/Platform.Numbers/Bit.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cpp/Platform.Numbers/Bit.h b/cpp/Platform.Numbers/Bit.h index a351734..310796b 100644 --- a/cpp/Platform.Numbers/Bit.h +++ b/cpp/Platform.Numbers/Bit.h @@ -1,6 +1,5 @@ #pragma once #include -#include #include namespace Platform::Numbers::Bit @@ -60,11 +59,11 @@ namespace Platform::Numbers::Bit { if (shift < 0) { - shift = sizeof(T) * CHAR_BIT + shift; + shift = sizeof(T) * std::numeric_limits::digits + shift; } if (limit < 0) { - limit = sizeof(T) * CHAR_BIT + limit; + limit = sizeof(T) * std::numeric_limits::digits + limit; } auto sourceMask = ~(std::numeric_limits::max() << limit) & std::numeric_limits::max(); auto targetMask = ~(sourceMask << shift); @@ -76,11 +75,11 @@ namespace Platform::Numbers::Bit { if (shift < 0) { - shift = sizeof(T) * CHAR_BIT + shift; + shift = sizeof(T) * std::numeric_limits::digits + shift; } if (limit < 0) { - limit = sizeof(T) * CHAR_BIT + limit; + limit = sizeof(T) * std::numeric_limits::digits + limit; } auto sourceMask = ~(std::numeric_limits::max() << limit) & std::numeric_limits::max(); auto targetMask = sourceMask << shift;