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}
This commit is contained in:
committed by
Commit Bot
parent
fae6f0e87b
commit
7356a5666d
@ -35,11 +35,11 @@ class DataRate final : public rtc_units_impl::RelativeUnit<DataRate> {
|
||||
static constexpr DataRate Infinity() { return PlusInfinity(); }
|
||||
template <int64_t bps>
|
||||
static constexpr DataRate BitsPerSec() {
|
||||
return FromStaticValue<bps>();
|
||||
return FromValue(bps);
|
||||
}
|
||||
template <int64_t kbps>
|
||||
static constexpr DataRate KilobitsPerSec() {
|
||||
return FromStaticFraction<kbps, 1000>();
|
||||
return FromFraction(1000, kbps);
|
||||
}
|
||||
template <typename T>
|
||||
static constexpr DataRate bps(T bits_per_second) {
|
||||
@ -49,12 +49,12 @@ class DataRate final : public rtc_units_impl::RelativeUnit<DataRate> {
|
||||
template <typename T>
|
||||
static constexpr DataRate bytes_per_sec(T bytes_per_second) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<8>(bytes_per_second);
|
||||
return FromFraction(8, bytes_per_second);
|
||||
}
|
||||
template <typename T>
|
||||
static constexpr DataRate kbps(T kilobits_per_sec) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000>(kilobits_per_sec);
|
||||
return FromFraction(1000, kilobits_per_sec);
|
||||
}
|
||||
template <typename T = int64_t>
|
||||
constexpr T bps() const {
|
||||
|
||||
@ -28,7 +28,7 @@ class DataSize final : public rtc_units_impl::RelativeUnit<DataSize> {
|
||||
static constexpr DataSize Infinity() { return PlusInfinity(); }
|
||||
template <int64_t bytes>
|
||||
static constexpr DataSize Bytes() {
|
||||
return FromStaticValue<bytes>();
|
||||
return FromValue(bytes);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@ -29,12 +29,12 @@ class Frequency final : public rtc_units_impl::RelativeUnit<Frequency> {
|
||||
Frequency() = delete;
|
||||
template <int64_t hertz>
|
||||
static constexpr Frequency Hertz() {
|
||||
return FromStaticFraction<hertz, 1000>();
|
||||
return FromFraction(1000, hertz);
|
||||
}
|
||||
template <typename T>
|
||||
static Frequency hertz(T hertz) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000>(hertz);
|
||||
return FromFraction(1000, hertz);
|
||||
}
|
||||
template <typename T>
|
||||
static Frequency millihertz(T hertz) {
|
||||
|
||||
@ -35,25 +35,25 @@ class TimeDelta final : public rtc_units_impl::RelativeUnit<TimeDelta> {
|
||||
TimeDelta() = delete;
|
||||
template <int64_t seconds>
|
||||
static constexpr TimeDelta Seconds() {
|
||||
return FromStaticFraction<seconds, 1000000>();
|
||||
return FromFraction(1'000'000, seconds);
|
||||
}
|
||||
template <int64_t ms>
|
||||
static constexpr TimeDelta Millis() {
|
||||
return FromStaticFraction<ms, 1000>();
|
||||
return FromFraction(1000, ms);
|
||||
}
|
||||
template <int64_t us>
|
||||
static constexpr TimeDelta Micros() {
|
||||
return FromStaticValue<us>();
|
||||
return FromValue(us);
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta seconds(T seconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000000>(seconds);
|
||||
return FromFraction(1'000'000, seconds);
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta ms(T milliseconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000>(milliseconds);
|
||||
return FromFraction(1000, milliseconds);
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta us(T microseconds) {
|
||||
|
||||
@ -32,26 +32,26 @@ class Timestamp final : public rtc_units_impl::UnitBase<Timestamp> {
|
||||
|
||||
template <int64_t seconds>
|
||||
static constexpr Timestamp Seconds() {
|
||||
return FromStaticFraction<seconds, 1000000>();
|
||||
return FromFraction(1'000'000, seconds);
|
||||
}
|
||||
template <int64_t ms>
|
||||
static constexpr Timestamp Millis() {
|
||||
return FromStaticFraction<ms, 1000>();
|
||||
return FromFraction(1000, ms);
|
||||
}
|
||||
template <int64_t us>
|
||||
static constexpr Timestamp Micros() {
|
||||
return FromStaticValue<us>();
|
||||
return FromValue(us);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static Timestamp seconds(T seconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000000>(seconds);
|
||||
return FromFraction(1'000'000, seconds);
|
||||
}
|
||||
template <typename T>
|
||||
static Timestamp ms(T milliseconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000>(milliseconds);
|
||||
return FromFraction(1000, milliseconds);
|
||||
}
|
||||
template <typename T>
|
||||
static Timestamp us(T microseconds) {
|
||||
|
||||
Reference in New Issue
Block a user