Introduce integer division helpers with non-default rounding

There are multiple places in webrtc code where alternative than
default rounding is desired. Typically this rounding is inlined.
e.g. as (<x> + <y>/2) / <y> making code more clumpsy (<y> might be long expression)
and unsafe for large values of <x>

This change introduce small helpers to address both concerns.

Bug: None
Change-Id: Icd8dcee80a697b7c50ba0b2e50295087d2be8670
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153354
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29222}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 694823c..8f13b0a 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -339,6 +339,16 @@
   ]
 }
 
+rtc_source_set("divide_round") {
+  sources = [
+    "numerics/divide_round.h",
+  ]
+  deps = [
+    ":checks",
+    ":safe_compare",
+  ]
+}
+
 rtc_source_set("safe_compare") {
   sources = [
     "numerics/safe_compare.h",
@@ -1132,6 +1142,7 @@
       "event_tracer_unittest.cc",
       "event_unittest.cc",
       "logging_unittest.cc",
+      "numerics/divide_round_unittest.cc",
       "numerics/histogram_percentile_counter_unittest.cc",
       "numerics/mod_ops_unittest.cc",
       "numerics/moving_max_counter_unittest.cc",
@@ -1164,6 +1175,7 @@
     }
     deps = [
       ":checks",
+      ":divide_round",
       ":gunit_helpers",
       ":rate_limiter",
       ":rtc_base",