| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2006 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 private: | 239 private: |
| 240 void Init(const char* file, int line); | 240 void Init(const char* file, int line); |
| 241 | 241 |
| 242 std::ostringstream stream_; | 242 std::ostringstream stream_; |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 // Performs the integer division a/b and returns the result. CHECKs that the | 245 // Performs the integer division a/b and returns the result. CHECKs that the |
| 246 // remainder is zero. | 246 // remainder is zero. |
| 247 template <typename T> | 247 template <typename T> |
| 248 inline T CheckedDivExact(T a, T b) { | 248 inline T CheckedDivExact(T a, T b) { |
| 249 RTC_CHECK_EQ(a % b, static_cast<T>(0)) << a << " is not evenly divisible by " | 249 RTC_CHECK_EQ(a % b, 0) << a << " is not evenly divisible by " << b; |
| 250 << b; | |
| 251 return a / b; | 250 return a / b; |
| 252 } | 251 } |
| 253 | 252 |
| 254 } // namespace rtc | 253 } // namespace rtc |
| 255 | 254 |
| 256 #else // __cplusplus not defined | 255 #else // __cplusplus not defined |
| 257 // C version. Lacks many features compared to the C++ version, but usage | 256 // C version. Lacks many features compared to the C++ version, but usage |
| 258 // guidelines are the same. | 257 // guidelines are the same. |
| 259 | 258 |
| 260 #define RTC_CHECK(condition) \ | 259 #define RTC_CHECK(condition) \ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 281 #define RTC_DCHECK_EQ(a, b) RTC_DCHECK((a) == (b)) | 280 #define RTC_DCHECK_EQ(a, b) RTC_DCHECK((a) == (b)) |
| 282 #define RTC_DCHECK_NE(a, b) RTC_DCHECK((a) != (b)) | 281 #define RTC_DCHECK_NE(a, b) RTC_DCHECK((a) != (b)) |
| 283 #define RTC_DCHECK_LE(a, b) RTC_DCHECK((a) <= (b)) | 282 #define RTC_DCHECK_LE(a, b) RTC_DCHECK((a) <= (b)) |
| 284 #define RTC_DCHECK_LT(a, b) RTC_DCHECK((a) < (b)) | 283 #define RTC_DCHECK_LT(a, b) RTC_DCHECK((a) < (b)) |
| 285 #define RTC_DCHECK_GE(a, b) RTC_DCHECK((a) >= (b)) | 284 #define RTC_DCHECK_GE(a, b) RTC_DCHECK((a) >= (b)) |
| 286 #define RTC_DCHECK_GT(a, b) RTC_DCHECK((a) > (b)) | 285 #define RTC_DCHECK_GT(a, b) RTC_DCHECK((a) > (b)) |
| 287 | 286 |
| 288 #endif // __cplusplus | 287 #endif // __cplusplus |
| 289 | 288 |
| 290 #endif // WEBRTC_BASE_CHECKS_H_ | 289 #endif // WEBRTC_BASE_CHECKS_H_ |
| OLD | NEW |