Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address casting from unsigned to signed types across the codebase #3913

Closed
coderabbitai bot opened this issue Nov 27, 2024 · 0 comments · Fixed by #3932
Closed

Address casting from unsigned to signed types across the codebase #3913

coderabbitai bot opened this issue Nov 27, 2024 · 0 comments · Fixed by #3932
Assignees

Comments

@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2024

Casting from unsigned to signed types may lead to data loss or unexpected behavior if values exceed the range of the signed type. It is recommended to use std::ptrdiff_t or remain within unsigned arithmetic.

Pull Request: #3615
Comment: #3615 (comment)

Requested by @AJPfleger.

@AJPfleger AJPfleger linked a pull request Dec 2, 2024 that will close this issue
@kodiakhq kodiakhq bot closed this as completed in #3932 Dec 5, 2024
kodiakhq bot pushed a commit that referenced this issue Dec 5, 2024
I went through the cases, where we did `cast<int>` from `std::size_t` and implemented solutions to avoid this.

closes:
- #3913

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Bug Fixes**
	- Improved type safety in various algorithms by changing loop index types from `int` to `std::size_t`.
	- Enhanced clarity in boundary condition checks within algorithms.

- **Documentation**
	- Corrected comments for clarity in the `DigitizationAlgorithm` class.

- **Chores**
	- Streamlined conditional logic in the `IndexedGridFiller` and `RefittingAlgorithm` classes for better readability and maintenance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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 a pull request may close this issue.

1 participant