Move some more numeric utility code from rtc_base/ to rtc_base/numerics/

Specifically, I'm moving

  histogram_percentile_counter.h
  mathutils.h
  mod_ops.h
  moving_max_counter.h

They shouldn't be part of the API, and moving them to an appropriate
subdirectory of rtc_base/ is a good way to keep track of that.

BUG=webrtc:8445

Change-Id: I78a999984a27ef935be2d7c3136475d5f209adda
Reviewed-on: https://webrtc-review.googlesource.com/20870
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20832}
This commit is contained in:
Karl Wiberg
2017-11-22 12:25:14 +01:00
committed by Commit Bot
parent 6196857826
commit 65c392265f
16 changed files with 33 additions and 32 deletions

View File

@ -14,7 +14,7 @@
#include "api/array_view.h"
#include "modules/audio_processing/rms_level.h"
#include "rtc_base/checks.h"
#include "rtc_base/mathutils.h"
#include "rtc_base/numerics/mathutils.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "test/gtest.h"

View File

@ -16,7 +16,7 @@
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/mod_ops.h"
#include "rtc_base/numerics/mod_ops.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {

View File

@ -23,7 +23,7 @@
#include "modules/rtp_rtcp/source/ulpfec_header_reader_writer.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/mod_ops.h"
#include "rtc_base/numerics/mod_ops.h"
namespace webrtc {

View File

@ -139,13 +139,13 @@ rtc_source_set("rtc_base_approved_generic") {
"flags.h",
"format_macros.h",
"function_view.h",
"histogram_percentile_counter.cc",
"histogram_percentile_counter.h",
"ignore_wundef.h",
"location.cc",
"location.h",
"mod_ops.h",
"moving_max_counter.h",
"numerics/histogram_percentile_counter.cc",
"numerics/histogram_percentile_counter.h",
"numerics/mod_ops.h",
"numerics/moving_max_counter.h",
"numerics/safe_compare.h",
"numerics/safe_conversions.h",
"numerics/safe_conversions_impl.h",
@ -610,7 +610,7 @@ rtc_static_library("rtc_base_generic") {
"callback.h",
"logsinks.cc",
"logsinks.h",
"mathutils.h",
"numerics/mathutils.h",
"optionsfile.cc",
"optionsfile.h",
"rollingaccumulator.h",
@ -870,11 +870,11 @@ if (rtc_include_tests) {
"event_unittest.cc",
"file_unittest.cc",
"function_view_unittest.cc",
"histogram_percentile_counter_unittest.cc",
"logging_unittest.cc",
"md5digest_unittest.cc",
"mod_ops_unittest.cc",
"moving_max_counter_unittest.cc",
"numerics/histogram_percentile_counter_unittest.cc",
"numerics/mod_ops_unittest.cc",
"numerics/moving_max_counter_unittest.cc",
"numerics/safe_compare_unittest.cc",
"numerics/safe_minmax_unittest.cc",
"onetimeevent_unittest.cc",

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/histogram_percentile_counter.h"
#include "rtc_base/numerics/histogram_percentile_counter.h"
#include <algorithm>
#include <cmath>

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_HISTOGRAM_PERCENTILE_COUNTER_H_
#define RTC_BASE_HISTOGRAM_PERCENTILE_COUNTER_H_
#ifndef RTC_BASE_NUMERICS_HISTOGRAM_PERCENTILE_COUNTER_H_
#define RTC_BASE_NUMERICS_HISTOGRAM_PERCENTILE_COUNTER_H_
#include <stdint.h>
#include <map>
@ -40,4 +40,4 @@ class HistogramPercentileCounter {
size_t total_elements_low_;
};
} // namespace rtc
#endif // RTC_BASE_HISTOGRAM_PERCENTILE_COUNTER_H_
#endif // RTC_BASE_NUMERICS_HISTOGRAM_PERCENTILE_COUNTER_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/histogram_percentile_counter.h"
#include "rtc_base/numerics/histogram_percentile_counter.h"
#include <utility>
#include <vector>

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_MATHUTILS_H_
#define RTC_BASE_MATHUTILS_H_
#ifndef RTC_BASE_NUMERICS_MATHUTILS_H_
#define RTC_BASE_NUMERICS_MATHUTILS_H_
#include <math.h>
#include <type_traits>
@ -36,4 +36,4 @@ typename std::make_unsigned<T>::type unsigned_difference(T x, T y) {
return static_cast<unsigned_type>(x) - static_cast<unsigned_type>(y);
}
#endif // RTC_BASE_MATHUTILS_H_
#endif // RTC_BASE_NUMERICS_MATHUTILS_H_

View File

@ -8,9 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_MOD_OPS_H_
#define RTC_BASE_MOD_OPS_H_
#ifndef RTC_BASE_NUMERICS_MOD_OPS_H_
#define RTC_BASE_NUMERICS_MOD_OPS_H_
#include <algorithm>
#include <limits>
#include <type_traits>
@ -139,4 +140,4 @@ inline T MinDiff(T a, T b) {
} // namespace webrtc
#endif // RTC_BASE_MOD_OPS_H_
#endif // RTC_BASE_NUMERICS_MOD_OPS_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/mod_ops.h"
#include "rtc_base/numerics/mod_ops.h"
#include "test/gtest.h"
namespace webrtc {

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_MOVING_MAX_COUNTER_H_
#define RTC_BASE_MOVING_MAX_COUNTER_H_
#ifndef RTC_BASE_NUMERICS_MOVING_MAX_COUNTER_H_
#define RTC_BASE_NUMERICS_MOVING_MAX_COUNTER_H_
#include <stdint.h>
@ -113,4 +113,4 @@ void MovingMaxCounter<T>::RollWindow(int64_t new_time_ms) {
} // namespace rtc
#endif // RTC_BASE_MOVING_MAX_COUNTER_H_
#endif // RTC_BASE_NUMERICS_MOVING_MAX_COUNTER_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/moving_max_counter.h"
#include "rtc_base/numerics/moving_max_counter.h"
#include "test/gtest.h"
TEST(MovingMaxCounter, ReportsMaximumInTheWindow) {

View File

@ -15,7 +15,7 @@
#include <type_traits>
#include "api/optional.h"
#include "rtc_base/mod_ops.h"
#include "rtc_base/numerics/mod_ops.h"
#include "rtc_base/numerics/safe_compare.h"
namespace webrtc {

View File

@ -13,7 +13,7 @@
#include <limits>
#include <vector>
#include "rtc_base/mathutils.h" // unsigned difference
#include "rtc_base/numerics/mathutils.h" // unsigned difference
#include "rtc_base/random.h"
#include "test/gtest.h"

View File

@ -21,8 +21,8 @@
#include "common_video/include/frame_callback.h"
#include "modules/video_coding/include/video_coding_defines.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/histogram_percentile_counter.h"
#include "rtc_base/moving_max_counter.h"
#include "rtc_base/numerics/histogram_percentile_counter.h"
#include "rtc_base/numerics/moving_max_counter.h"
#include "rtc_base/rate_statistics.h"
#include "rtc_base/ratetracker.h"
#include "rtc_base/thread_annotations.h"

View File

@ -16,7 +16,7 @@
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "rtc_base/checks.h"
#include "rtc_base/mod_ops.h"
#include "rtc_base/numerics/mod_ops.h"
namespace {
constexpr uint16_t kSeqNumHalf = 0x8000u;