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

PPUAnalyser: fix std::move misuse #14011

Merged
merged 1 commit into from
Jun 14, 2023
Merged

PPUAnalyser: fix std::move misuse #14011

merged 1 commit into from
Jun 14, 2023

Conversation

Megamouse
Copy link
Contributor

@Megamouse Megamouse commented Jun 12, 2023

There seems to be an unwanted - or at least mishandled - std::move of the ppu function map in ppu_module::analyse.
The object is used later again, so this seems like a bug to me.

@@ -1539,7 +1543,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
end = 0;
}

for (auto&& [_, func] : as_rvalue(std::move(fmap)))

This comment was marked as resolved.

@@ -665,8 +665,8 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
break;
}

const u32 addr = ptr[0];
const u32 _toc = ptr[1];
const u32& addr = ptr[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk, from experience const ref is faster even for simple types.
Or can it change here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References should be avoided as it's fragile. It may not always result in reference binding. For instance it's not even obvious what it does here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants