Index: webrtc/base/safe_compare.h |
diff --git a/webrtc/base/safe_compare.h b/webrtc/base/safe_compare.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..acdd9cebd7ab1cf0d8a416e612b6fe9cb1377b2f |
--- /dev/null |
+++ b/webrtc/base/safe_compare.h |
@@ -0,0 +1,39 @@ |
+/* |
+ * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+// This file defines six constexpr functions: |
+// |
+// rtc::SafeEq // == |
+// rtc::SafeNe // != |
+// rtc::SafeLt // < |
+// rtc::SafeLe // <= |
+// rtc::SafeGt // > |
+// rtc::SafeGe // >= |
+// |
+// They each accept two arguments of arbitrary types, and in almost all cases, |
+// they simply call the appropriate comparison operator. However, if both |
+// arguments are integers, they don't compare them using C++'s quirky rules, |
+// but instead adhere to the true mathematical definitions. It is as if the |
+// arguments were first converted to infinite-range signed integers, and then |
+// compared, although of course nothing expensive like that actually takes |
+// place. In practice, for signed/signed and unsigned/unsigned comparisons and |
+// some mixed-signed comparisons with a compile-time constant, the overhead is |
+// zero; in the remaining cases, it is just a few machine instructions (no |
+// branches). |
+ |
+#ifndef WEBRTC_BASE_SAFE_COMPARE_H_ |
+#define WEBRTC_BASE_SAFE_COMPARE_H_ |
+ |
+ |
+// This header is deprecated and is just left here temporarily during |
+// refactoring. See https://bugs.webrtc.org/7634 for more details. |
+#include "webrtc/rtc_base/safe_compare.h" |
+ |
+#endif // WEBRTC_BASE_SAFE_COMPARE_H_ |