aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/ylimits.h
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /util/generic/ylimits.h
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/ylimits.h')
-rw-r--r--util/generic/ylimits.h102
1 files changed, 51 insertions, 51 deletions
diff --git a/util/generic/ylimits.h b/util/generic/ylimits.h
index 9bc5f4e162..fe42b4dfc0 100644
--- a/util/generic/ylimits.h
+++ b/util/generic/ylimits.h
@@ -39,54 +39,54 @@ static constexpr ::NPrivate::TMax Max() noexcept {
static constexpr ::NPrivate::TMin Min() noexcept {
return {};
}
-
-namespace NPrivate {
- template <unsigned long long N>
- static constexpr double MaxFloorValue() {
- return N;
- }
- template <unsigned long long N>
- static constexpr double MaxCeilValue() {
- return N;
- }
- template <>
- constexpr double MaxFloorValue<0x7FFF'FFFF'FFFF'FFFFull>() {
- return 9223372036854774784.0; // 0x7FFFFFFFFFFFFC00p0
- }
- template <>
- constexpr double MaxCeilValue<0x7FFF'FFFF'FFFF'FFFFull>() {
- return 9223372036854775808.0; // 0x8000000000000000p0
- }
- template <>
- constexpr double MaxFloorValue<0xFFFF'FFFF'FFFF'FFFFull>() {
- return 18446744073709549568.0; // 0xFFFFFFFFFFFFF800p0
- }
- template <>
- constexpr double MaxCeilValue<0xFFFF'FFFF'FFFF'FFFFull>() {
- return 18446744073709551616.0; // 0x10000000000000000p0
- }
-}
-
-// MaxFloor<T> is the greatest double within the range of T.
-//
-// 1. If Max<T> is an exact double, MaxFloor<T> = Max<T> = MaxCeil<T>.
-// In this case some doubles above MaxFloor<T> cast to T may round
-// to Max<T> depending on the rounding mode.
-//
-// 2. Otherwise Max<T> is between MaxFloor<T> and MaxCeil<T>, and
-// MaxFloor<T> is the largest double that does not overflow T.
-template <class T>
-static constexpr double MaxFloor() noexcept {
- return ::NPrivate::MaxFloorValue<Max<T>()>();
-}
-
-// MaxCeil<T> is the smallest double not lesser than Max<T>.
-//
-// 1. If Max<T> is an exact double, MaxCeil<T> = Max<T> = MaxFloor<T>.
-//
-// 2. Otherwise Max<T> is between MaxFloor<T> and MaxCeil<T>, and
-// MaxCeil<T> is the smallest double that overflows T.
-template <class T>
-static constexpr double MaxCeil() noexcept {
- return ::NPrivate::MaxCeilValue<Max<T>()>();
-}
+
+namespace NPrivate {
+ template <unsigned long long N>
+ static constexpr double MaxFloorValue() {
+ return N;
+ }
+ template <unsigned long long N>
+ static constexpr double MaxCeilValue() {
+ return N;
+ }
+ template <>
+ constexpr double MaxFloorValue<0x7FFF'FFFF'FFFF'FFFFull>() {
+ return 9223372036854774784.0; // 0x7FFFFFFFFFFFFC00p0
+ }
+ template <>
+ constexpr double MaxCeilValue<0x7FFF'FFFF'FFFF'FFFFull>() {
+ return 9223372036854775808.0; // 0x8000000000000000p0
+ }
+ template <>
+ constexpr double MaxFloorValue<0xFFFF'FFFF'FFFF'FFFFull>() {
+ return 18446744073709549568.0; // 0xFFFFFFFFFFFFF800p0
+ }
+ template <>
+ constexpr double MaxCeilValue<0xFFFF'FFFF'FFFF'FFFFull>() {
+ return 18446744073709551616.0; // 0x10000000000000000p0
+ }
+}
+
+// MaxFloor<T> is the greatest double within the range of T.
+//
+// 1. If Max<T> is an exact double, MaxFloor<T> = Max<T> = MaxCeil<T>.
+// In this case some doubles above MaxFloor<T> cast to T may round
+// to Max<T> depending on the rounding mode.
+//
+// 2. Otherwise Max<T> is between MaxFloor<T> and MaxCeil<T>, and
+// MaxFloor<T> is the largest double that does not overflow T.
+template <class T>
+static constexpr double MaxFloor() noexcept {
+ return ::NPrivate::MaxFloorValue<Max<T>()>();
+}
+
+// MaxCeil<T> is the smallest double not lesser than Max<T>.
+//
+// 1. If Max<T> is an exact double, MaxCeil<T> = Max<T> = MaxFloor<T>.
+//
+// 2. Otherwise Max<T> is between MaxFloor<T> and MaxCeil<T>, and
+// MaxCeil<T> is the smallest double that overflows T.
+template <class T>
+static constexpr double MaxCeil() noexcept {
+ return ::NPrivate::MaxCeilValue<Max<T>()>();
+}