Commit graph

6 commits

Author SHA1 Message Date
Danil Chapovalov
ef9bcd17a5 Make webrtc units division by integer constexpr
std::round is not constexpr until c++23 and force conversion to floating point which is unnecessary for integer devision

For integer division change rounding to 'round down' from 'round to nearest' as less surprising.

Bug: webrtc:13756
Change-Id: I9c2382bafc9ddccb0f54d6e7bf8cac4f2a3175a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265863
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37250}
2022-06-17 10:34:09 +00:00
Evan Shrubsole
21e97f9b9d Add unary operator- to units
This will be used in the frame buffer 3 scheduler.

Bug: webrtc:13343
Change-Id: Ib699072021da30022a34aabe24e36a37e89ddf41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245642
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35658}
2022-01-11 14:12:54 +00:00
Mirko Bonadei
cfa0e8ffe2 Fix errors C2238, C2248 and C2059 on MSVC bots.
This CL fixes the following errors on MSVC bots:

../../rtc_base/units/unit_base_unittest.cc(42): error C2059:
  syntax error: '<'

../../rtc_base/units/unit_base_unittest.cc(42): error C2238:
  unexpected token(s) preceding ';'

../..\rtc_base/units/unit_base.h(39): error C2248:
  'webrtc::`anonymous-namespace'::TestUnit::TestUnit':
  cannot access protected member declared in class
  'webrtc::`anonymous-namespace'::TestUnit'

No-Try: True
Bug: None
Change-Id: Ic63a75132107381474aca2e1d42ba96d1f6a1c00
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172621
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30972}
2020-04-02 09:54:27 +00:00
Sebastian Jansson
d7fade5738 Makes all units and operations constexpr
Since RTC_DCHECK was made constexpr compatible, we can now
make the unit classes fully constexpr.

Bug: webrtc:9883
Change-Id: I18973c2f318449869cf0bd45699c41be53fba806
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167722
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30403}
2020-01-29 10:57:54 +00:00
Danil Chapovalov
7356a5666d Remove unit_base functions FromStaticX
instead make functions FromX constexpr and use them.

Bug: None
Change-Id: I826c8ad5ac8b3bd97f298a99c40b31b8c63b5f85
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159220
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30321}
2020-01-20 13:04:56 +00:00
Sebastian Jansson
72bba625d5 Adds shared base class for data units.
This reduces code duplication and ensures common behavior
between the unit classes.

Bug: webrtc:9709
Change-Id: I9529ef10b3f538355f53250a2b67c6b4e250cce8
Reviewed-on: https://webrtc-review.googlesource.com/c/110901
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25690}
2018-11-19 12:41:33 +00:00