mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
102
third_party/libcxx/__chrono/month.h
vendored
102
third_party/libcxx/__chrono/month.h
vendored
|
@ -22,64 +22,76 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace chrono
|
||||
{
|
||||
namespace chrono {
|
||||
|
||||
class month {
|
||||
private:
|
||||
unsigned char __m_;
|
||||
unsigned char __m_;
|
||||
|
||||
public:
|
||||
month() = default;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept : __m_(static_cast<unsigned char>(__val)) {}
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept { ++__m_; return *this; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept { --__m_; return *this; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; }
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
|
||||
month() = default;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept
|
||||
: __m_(static_cast<unsigned char>(__val)) {}
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept {
|
||||
*this += months{1};
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept {
|
||||
month __tmp = *this;
|
||||
++(*this);
|
||||
return __tmp;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept {
|
||||
*this -= months{1};
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept {
|
||||
month __tmp = *this;
|
||||
--(*this);
|
||||
return __tmp;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
|
||||
_LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
|
||||
};
|
||||
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
bool operator==(const month& __lhs, const month& __rhs) noexcept
|
||||
{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
|
||||
return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
|
||||
return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
month operator+ (const month& __lhs, const months& __rhs) noexcept
|
||||
{
|
||||
auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
|
||||
auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
|
||||
return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
|
||||
return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
month operator+ (const months& __lhs, const month& __rhs) noexcept
|
||||
{ return __rhs + __lhs; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
month operator- (const month& __lhs, const months& __rhs) noexcept
|
||||
{ return __lhs + -__rhs; }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
months operator-(const month& __lhs, const month& __rhs) noexcept
|
||||
{
|
||||
auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
|
||||
return months(__dm <= 11 ? __dm : __dm + 12);
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
|
||||
auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
|
||||
auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
|
||||
return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
month& month::operator+=(const months& __dm) noexcept
|
||||
{ *this = *this + __dm; return *this; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
|
||||
return __rhs + __lhs;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr
|
||||
month& month::operator-=(const months& __dm) noexcept
|
||||
{ *this = *this - __dm; return *this; }
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
|
||||
return __lhs + -__rhs;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
|
||||
auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
|
||||
return months(__dm <= 11 ? __dm : __dm + 12);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator+=(const months& __dm) noexcept {
|
||||
*this = *this + __dm;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator-=(const months& __dm) noexcept {
|
||||
*this = *this - __dm;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline constexpr month January{1};
|
||||
inline constexpr month February{2};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue