mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 10:31:57 +00:00
Simplification
This commit is contained in:
parent
b461542388
commit
29f1a87016
@ -5,6 +5,7 @@
|
||||
#include <common/types.h>
|
||||
#include <common/wide_integer.h>
|
||||
|
||||
|
||||
using Int128 = wide::integer<128, signed>;
|
||||
using UInt128 = wide::integer<128, unsigned>;
|
||||
using Int256 = wide::integer<256, signed>;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/extended_types.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Core/Types.h>
|
||||
#include <IO/ReadBuffer.h>
|
||||
@ -37,14 +38,14 @@ namespace DB
|
||||
* integral type which should be at least 32 bits wide, and
|
||||
* should preferably signed.
|
||||
*/
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> * = nullptr>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> * = nullptr>
|
||||
GregorianDate(T mjd);
|
||||
|
||||
/** Convert to Modified Julian Day. The type T is an integral type
|
||||
* which should be at least 32 bits wide, and should preferably
|
||||
* signed.
|
||||
*/
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> * = nullptr>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> * = nullptr>
|
||||
T toModifiedJulianDay() const;
|
||||
|
||||
/** Write the date in text form 'YYYY-MM-DD' to a buffer.
|
||||
@ -89,14 +90,14 @@ namespace DB
|
||||
* integral type which should be at least 32 bits wide, and
|
||||
* should preferably signed.
|
||||
*/
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> * = nullptr>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> * = nullptr>
|
||||
OrdinalDate(T mjd);
|
||||
|
||||
/** Convert to Modified Julian Day. The type T is an integral
|
||||
* type which should be at least 32 bits wide, and should
|
||||
* preferably be signed.
|
||||
*/
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> * = nullptr>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> * = nullptr>
|
||||
T toModifiedJulianDay() const noexcept;
|
||||
|
||||
YearT year() const noexcept
|
||||
@ -258,7 +259,7 @@ namespace DB
|
||||
}
|
||||
|
||||
template <typename YearT>
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> *>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> *>
|
||||
GregorianDate<YearT>::GregorianDate(T mjd)
|
||||
{
|
||||
const OrdinalDate<YearT> ord(mjd);
|
||||
@ -269,7 +270,7 @@ namespace DB
|
||||
}
|
||||
|
||||
template <typename YearT>
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> *>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> *>
|
||||
T GregorianDate<YearT>::toModifiedJulianDay() const
|
||||
{
|
||||
const MonthDay md(month_, day_of_month_);
|
||||
@ -331,7 +332,7 @@ namespace DB
|
||||
}
|
||||
|
||||
template <typename YearT>
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> *>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> *>
|
||||
OrdinalDate<YearT>::OrdinalDate(T mjd)
|
||||
{
|
||||
const auto a = mjd + 678575;
|
||||
@ -347,7 +348,7 @@ namespace DB
|
||||
}
|
||||
|
||||
template <typename YearT>
|
||||
template <typename T, std::enable_if_t<wide::IntegralConcept<T>()> *>
|
||||
template <typename T, std::enable_if_t<is_integer_v<T>> *>
|
||||
T OrdinalDate<YearT>::toModifiedJulianDay() const noexcept
|
||||
{
|
||||
const auto y = year_ - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user