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
Use range loop (if possible) #7770
Conversation
|
|
Should be ok now. |
Source/Core/Core/DSP/DSPCore.cpp
Outdated
| for (size_t i = 0; i < ArraySize(g_dsp.reg_stack); i++) | ||
| std::fill(std::begin(g_dsp.reg_stack[i]), std::end(g_dsp.reg_stack[i]), 0); | ||
| for (auto& i : g_dsp.reg_stack) | ||
| std::fill(std::begin(i), std::end(i), 0); |
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 dunno about using i for a loop value. Granted, in this case I'm not sure what a better name would be, but that just gives the wrong impression when glancing over the code.
You do this in a few other spots too.
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.
That'd be the only shortcomings I see with this PR - most of those single-letter iteration variables could use a better name. Or least don't call them i which is the most likely one to be used in a plain for loop as counter.
| for (size_t i = 0; i < ArraySize(key_map); i++) | ||
| ImGui::GetIO().KeyMap[key_map[i][0]] = (key_map[i][1] & 0x1FF); | ||
| for (auto i : key_map) | ||
| ImGui::GetIO().KeyMap[i[0]] = (i[1] & 0x1FF); |
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.
Shouldn't this use auto& too?
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 think it's not needed. (if you expand up, you will see that key_map is array of ints)
|
Renamed a bit. |
|
From the style guide:
|
|
Small up. |
|
Rebased. |
|
Fixed linter error. |
|
Can we get another rebase, please? |
|
@jordan-woyak, should be ok now. |
|
Thx for help with formatting. |
|
No problem. I configure my editor to clang-format on save so I can't forget. |
Should behave as original code, but without magic numbers and looks a bit simpler.
// not sure if formatting will satisfy you :(