Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 11, 2025

Summary

This PR implements the removal of the ExternalZero concept as requested in issue #120.

Changes Made

  • Removed ExternalZero constant from both C# (Hybrid.cs) and C++ (Hybrid.h) implementations
  • Updated logic in key properties:
    • IsNothing: Now simply checks Value == default (C#) or Value == 0 (C++)
    • IsExternal: Uses (Value == default) || SignedValue < 0 instead of ExternalZero check
    • AbsoluteValue: Uses (Value == default) ? 0 : Math.Abs(SignedValue) pattern
  • Modified constructors to assign default/0 instead of ExternalZero for external zero values
  • Updated LinksConstants to use zero as the minimum external reference range
  • Updated unit tests to expect zero instead of ExternalZero in test assertions

Impact

As described in the issue, this change brings:

Pros:
✅ Bitwise operations safety
✅ Better performance with conversion of raw numbers
✅ Zeros in memory managers are now searchable

Cons:
⚠️ Worse performance of memory managers (additional if branches for zero and indexing of zero values)
⚠️ Large change across the codebase

Test Results

  • C# project builds successfully with no compilation errors
  • All ExternalZero references have been completely removed from the codebase
  • Unit tests updated to reflect the new zero handling behavior

Fixes #120

🤖 Generated with Claude Code

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

Issue: #120
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 14:56
- Removed ExternalZero constant from both C# and C++ Hybrid classes
- Updated IsNothing, IsExternal, and AbsoluteValue properties to use default/zero
- Modified constructors to assign default value instead of ExternalZero
- Updated LinksConstants to use zero as minimum external reference range
- Updated corresponding unit tests

This change makes regular (internal) zero become external, improving
bitwise operations safety and performance with raw number conversions.

Fixes #120

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Remove External Zero concept Remove External Zero concept Sep 11, 2025
@konard konard marked this pull request as ready for review September 11, 2025 12:08
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.

Remove External Zero concept

2 participants