| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_BASE_FUNCTIONAL_H_ | 5 #ifndef V8_BASE_FUNCTIONAL_H_ |
| 6 #define V8_BASE_FUNCTIONAL_H_ | 6 #define V8_BASE_FUNCTIONAL_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 inline size_t hash_combine(T const& v, Ts const&... vs) { | 69 inline size_t hash_combine(T const& v, Ts const&... vs) { |
| 70 return hash_combine(hash<T>()(v), hash_combine(vs...)); | 70 return hash_combine(hash<T>()(v), hash_combine(vs...)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 #define V8_BASE_HASH_VALUE_TRIVIAL(type) \ | 74 #define V8_BASE_HASH_VALUE_TRIVIAL(type) \ |
| 75 inline size_t hash_value(type v) { return static_cast<size_t>(v); } | 75 inline size_t hash_value(type v) { return static_cast<size_t>(v); } |
| 76 V8_BASE_HASH_VALUE_TRIVIAL(bool) | 76 V8_BASE_HASH_VALUE_TRIVIAL(bool) |
| 77 V8_BASE_HASH_VALUE_TRIVIAL(unsigned char) | 77 V8_BASE_HASH_VALUE_TRIVIAL(unsigned char) |
| 78 V8_BASE_HASH_VALUE_TRIVIAL(unsigned short) // NOLINT(runtime/int) | 78 V8_BASE_HASH_VALUE_TRIVIAL(unsigned short) // NOLINT(runtime/int) |
| 79 V8_BASE_HASH_VALUE_TRIVIAL(unsigned int) | |
| 80 #undef V8_BASE_HASH_VALUE_TRIVIAL | 79 #undef V8_BASE_HASH_VALUE_TRIVIAL |
| 81 | 80 |
| 82 size_t hash_value(unsigned long v); // NOLINT(runtime/int) | 81 size_t hash_value(unsigned int); |
| 83 size_t hash_value(unsigned long long v); // NOLINT(runtime/int) | 82 size_t hash_value(unsigned long); // NOLINT(runtime/int) |
| 83 size_t hash_value(unsigned long long); // NOLINT(runtime/int) |
| 84 | 84 |
| 85 #define V8_BASE_HASH_VALUE_SIGNED(type) \ | 85 #define V8_BASE_HASH_VALUE_SIGNED(type) \ |
| 86 inline size_t hash_value(signed type v) { \ | 86 inline size_t hash_value(signed type v) { \ |
| 87 return hash_value(bit_cast<unsigned type>(v)); \ | 87 return hash_value(bit_cast<unsigned type>(v)); \ |
| 88 } | 88 } |
| 89 V8_BASE_HASH_VALUE_SIGNED(char) | 89 V8_BASE_HASH_VALUE_SIGNED(char) |
| 90 V8_BASE_HASH_VALUE_SIGNED(short) // NOLINT(runtime/int) | 90 V8_BASE_HASH_VALUE_SIGNED(short) // NOLINT(runtime/int) |
| 91 V8_BASE_HASH_VALUE_SIGNED(int) // NOLINT(runtime/int) | 91 V8_BASE_HASH_VALUE_SIGNED(int) // NOLINT(runtime/int) |
| 92 V8_BASE_HASH_VALUE_SIGNED(long) // NOLINT(runtime/int) | 92 V8_BASE_HASH_VALUE_SIGNED(long) // NOLINT(runtime/int) |
| 93 V8_BASE_HASH_VALUE_SIGNED(long long) // NOLINT(runtime/int) | 93 V8_BASE_HASH_VALUE_SIGNED(long long) // NOLINT(runtime/int) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 : public std::unary_function<std::pair<T1, T2>, size_t> { | 145 : public std::unary_function<std::pair<T1, T2>, size_t> { |
| 146 size_t operator()(std::pair<T1, T2> const& v) const { | 146 size_t operator()(std::pair<T1, T2> const& v) const { |
| 147 return ::v8::base::hash_value(v); | 147 return ::v8::base::hash_value(v); |
| 148 } | 148 } |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace base | 151 } // namespace base |
| 152 } // namespace v8 | 152 } // namespace v8 |
| 153 | 153 |
| 154 #endif // V8_BASE_FUNCTIONAL_H_ | 154 #endif // V8_BASE_FUNCTIONAL_H_ |
| OLD | NEW |