Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request introduces several changes, primarily focusing on adding new functionality, improving debugging, and optimizing arithmetic operations for the BigUInt type. Additionally, it includes updates to documentation and minor refactoring. Below is a summary of the most significant changes:

New Functionality

  • Added support for benchmarking the square root operation in benches/biguint/bench.mojo. This includes importing the bench_sqrt function, updating the command options to include sqrt, and adding the corresponding execution logic.
  • Introduced the subtract_inplace_by_uint32 function to perform in-place subtraction of a UInt32 value from a BigUInt number. This function includes handling for borrow propagation.

Debugging Enhancements

  • Added multiple debug_assert statements across arithmetic operations (add, subtract, multiply, etc.) to check for uninitialized BigUInt values and ensure there are no leading zero words. These assertions improve error detection and debugging during development.

Optimizations and Refactoring

  • Replaced slice-based initialization (e.g., BigUInt(words=y.words[bounds_y[0]:bounds_y[1]])) with the more efficient BigUInt.from_slice method in several places, improving clarity and performance.
  • Simplified the multiply_slices_karatsuba function by adding a zero-check for input slices, avoiding unnecessary computations when one of the slices is zero.

Documentation Updates

  • Updated the docs/todo.md file to reflect completed tasks and clarify the purpose of the to-do list.

Code Cleanup

  • Removed unused or redundant functions, such as negative_inplace and absolute_inplace, as they served no meaningful purpose for unsigned integers.

@forfudan forfudan merged commit 6240ecc into main Jul 14, 2025
1 check passed
@forfudan forfudan deleted the work branch July 14, 2025 17:11
forfudan added a commit that referenced this pull request Jul 14, 2025
forfudan added a commit that referenced this pull request Jul 15, 2025
forfudan added a commit that referenced this pull request Jul 18, 2025
forfudan added a commit that referenced this pull request Jul 24, 2025
forfudan added a commit that referenced this pull request Jul 26, 2025
forfudan added a commit that referenced this pull request Jul 31, 2025
forfudan added a commit that referenced this pull request Aug 3, 2025
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