OLD | NEW |
---|---|
(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_ | |
OLD | NEW |