Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: gpu/command_buffer/service/mailbox_manager.cc

Issue 538273002: Avoid memcmp on potentially unpacked structs in MailboxManager::TargetNameLess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/mailbox_manager.cc
diff --git a/gpu/command_buffer/service/mailbox_manager.cc b/gpu/command_buffer/service/mailbox_manager.cc
index 12a13fbac4cea8e77d07779bd44dbe26d9db0f4a..e6962df5ec8ec61c880e8d572f0b39c5c254eafe 100644
--- a/gpu/command_buffer/service/mailbox_manager.cc
+++ b/gpu/command_buffer/service/mailbox_manager.cc
@@ -101,7 +101,9 @@ MailboxManager::TargetName::TargetName(unsigned target, const Mailbox& mailbox)
bool MailboxManager::TargetNameLess(const MailboxManager::TargetName& lhs,
const MailboxManager::TargetName& rhs) {
- return memcmp(&lhs, &rhs, sizeof(lhs)) < 0;
+ if (lhs.target != rhs.target)
+ return lhs.target < rhs.target;
+ return lhs.mailbox < rhs.mailbox;
}
} // namespace gles2
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698