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
Convert PointerWrap::Mode to enum class #10668
Convert PointerWrap::Mode to enum class #10668
Conversation
|
Looks good. re: the individual points
I'm not that hard pressed either way about this
If all that matters is that the entries have a distinct value, then yeah, the assignment can be removed
Yeah, having dedicated functions to query modes would be nice. May even be able to make the mode enum itself internal doing this as well |
|
You gonna do more here or should we just merge this for now? |
|
Don't merge just yet, I'm in the middle of refactoring some things related to the above conversation. |
e6d2299
to
7cb793c
Compare
|
I made various changes listed in the PR description. The enum class is still public because its values are used in PointerWrap's constructor, and I haven't found an alternative I'm happy with. Options I considered:
Unless I'm missing something simple I think keeping the status quo here is best. |
7cb793c
to
c8e20c5
Compare
| if (!IsMeasureMode() && (*m_ptr_current + size) > m_ptr_end) | ||
| { | ||
| // trying to read/write past the end of the buffer, prevent this | ||
| mode = MODE_MEASURE; | ||
| SetMeasureMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I squashed most of the prior commits.
This pair of changes is new in the squash. I had previously omitted them because I assumed the inline declaration meant it was in an especially critical path and I wanted to avoid adding any function calls, but according to https://github.com/dolphin-emu/dolphin/pull/892/commits that wasn't the case.
Standard enum class conversion, along with some refactoring to make using PointerWraps a bit more convenient.
I've gone with smaller commits for easier reviewing, but I'll squish everything before merging.