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

Side by Side Diff: mojo/edk/system/ports/hash_functions.h

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_PORTS_HASH_FUNCTIONS_H_
6 #define MOJO_EDK_SYSTEM_PORTS_HASH_FUNCTIONS_H_
7
8 #include <functional>
9
10 #include "mojo/edk/system/ports/name.h"
11
12 namespace std {
13
14 template <>
15 struct hash<mojo::edk::ports::PortName> {
16 std::size_t operator()(const mojo::edk::ports::PortName& name) const {
17 size_t h1 = hash<uint64_t>()(name.v1);
Anand Mistry (off Chromium) 2016/01/28 02:26:24 Since avoid //base doesn't appear to be a goal for
18 size_t h2 = hash<uint64_t>()(name.v2);
19 return h1 ^ (h2 << 1);
20 }
21 };
22
23 template <>
24 struct hash<mojo::edk::ports::NodeName> {
25 std::size_t operator()(const mojo::edk::ports::NodeName& name) const {
26 size_t h1 = hash<uint64_t>()(name.v1);
27 size_t h2 = hash<uint64_t>()(name.v2);
28 return h1 ^ (h2 << 1);
29 }
30 };
31
32 } // namespace std
33
34 #endif // MOJO_EDK_SYSTEM_PORTS_HASH_FUNCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698