OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // they simply call the appropriate comparison operator. However, if both | 21 // they simply call the appropriate comparison operator. However, if both |
22 // arguments are integers, they don't compare them using C++'s quirky rules, | 22 // arguments are integers, they don't compare them using C++'s quirky rules, |
23 // but instead adhere to the true mathematical definitions. It is as if the | 23 // but instead adhere to the true mathematical definitions. It is as if the |
24 // arguments were first converted to infinite-range signed integers, and then | 24 // arguments were first converted to infinite-range signed integers, and then |
25 // compared, although of course nothing expensive like that actually takes | 25 // compared, although of course nothing expensive like that actually takes |
26 // place. In practice, for signed/signed and unsigned/unsigned comparisons and | 26 // place. In practice, for signed/signed and unsigned/unsigned comparisons and |
27 // some mixed-signed comparisons with a compile-time constant, the overhead is | 27 // some mixed-signed comparisons with a compile-time constant, the overhead is |
28 // zero; in the remaining cases, it is just a few machine instructions (no | 28 // zero; in the remaining cases, it is just a few machine instructions (no |
29 // branches). | 29 // branches). |
30 | 30 |
31 #ifndef WEBRTC_BASE_SAFE_COMPARE_H_ | 31 #ifndef WEBRTC_RTC_BASE_SAFE_COMPARE_H_ |
32 #define WEBRTC_BASE_SAFE_COMPARE_H_ | 32 #define WEBRTC_RTC_BASE_SAFE_COMPARE_H_ |
33 | 33 |
34 #include <stddef.h> | 34 #include <stddef.h> |
35 #include <stdint.h> | 35 #include <stdint.h> |
36 | 36 |
37 #include <type_traits> | 37 #include <type_traits> |
38 #include <utility> | 38 #include <utility> |
39 | 39 |
40 #include "webrtc/base/type_traits.h" | 40 #include "webrtc/base/type_traits.h" |
41 | 41 |
42 namespace rtc { | 42 namespace rtc { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 RTC_SAFECMP_MAKE_FUN(Eq) | 166 RTC_SAFECMP_MAKE_FUN(Eq) |
167 RTC_SAFECMP_MAKE_FUN(Ne) | 167 RTC_SAFECMP_MAKE_FUN(Ne) |
168 RTC_SAFECMP_MAKE_FUN(Lt) | 168 RTC_SAFECMP_MAKE_FUN(Lt) |
169 RTC_SAFECMP_MAKE_FUN(Le) | 169 RTC_SAFECMP_MAKE_FUN(Le) |
170 RTC_SAFECMP_MAKE_FUN(Gt) | 170 RTC_SAFECMP_MAKE_FUN(Gt) |
171 RTC_SAFECMP_MAKE_FUN(Ge) | 171 RTC_SAFECMP_MAKE_FUN(Ge) |
172 #undef RTC_SAFECMP_MAKE_FUN | 172 #undef RTC_SAFECMP_MAKE_FUN |
173 | 173 |
174 } // namespace rtc | 174 } // namespace rtc |
175 | 175 |
176 #endif // WEBRTC_BASE_SAFE_COMPARE_H_ | 176 #endif // WEBRTC_RTC_BASE_SAFE_COMPARE_H_ |
OLD | NEW |