Fix Range copy constructor buffer sizes - #104
Open
bagel786 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The copy constructor still omits the relative-bound members, leaving copied ranges with invalid bounds.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes Range copy-constructor buffer sizing and adds regression coverage for copied ranges.
Changes:
- Copies
dx/dybuffers usingsizeof(int). - Adds
CircleRangecopy regression tests. - Updates math calls and bumps version to
0.3.5.
File summaries
| File | Summary |
|---|---|
src/gridworld/test.cc |
Adds copy-constructor regression coverage. |
src/gridworld/Range.h |
Corrects buffer copying; relative-bound members remain omitted from the copy constructor. |
magent2/__init__.py |
Bumps the package version. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+31
to
+32
| memcpy(dx, other.dx, sizeof(int) * width * height); | ||
| memcpy(dy, other.dy, sizeof(int) * width * height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Copy the
dxanddyinteger buffers usingsizeof(int)instead ofsizeof(bool). The previous byte count truncated copied offsets and could corrupt copied range behavior.Adds a
CircleRangecopy regression test covering dimensions, membership, count, and every index-to-offset mapping.Addresses the
Range.hcopy-constructor item split out from #65 and tracked in #70. It intentionally makes no dependency orrequirements.txtchanges, following the maintainer note on #70.Testing
testlibpassed.pre-commit run --all-filespassed.