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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 private: | 213 private: |
214 void Init(const char* file, int line); | 214 void Init(const char* file, int line); |
215 | 215 |
216 std::ostringstream stream_; | 216 std::ostringstream stream_; |
217 }; | 217 }; |
218 | 218 |
219 // Performs the integer division a/b and returns the result. CHECKs that the | 219 // Performs the integer division a/b and returns the result. CHECKs that the |
220 // remainder is zero. | 220 // remainder is zero. |
221 template <typename T> | 221 template <typename T> |
222 inline T CheckedDivExact(T a, T b) { | 222 inline T CheckedDivExact(T a, T b) { |
223 RTC_CHECK_EQ(a % b, static_cast<T>(0)); | 223 RTC_CHECK_EQ(a % b, static_cast<T>(0)) << a << " is not evenly divisible by " |
| 224 << b; |
224 return a / b; | 225 return a / b; |
225 } | 226 } |
226 | 227 |
227 } // namespace rtc | 228 } // namespace rtc |
228 | 229 |
229 #endif // WEBRTC_BASE_CHECKS_H_ | 230 #endif // WEBRTC_BASE_CHECKS_H_ |
OLD | NEW |