Hard code year::min(), year::max() to [-32767, 32767]

* When year < 0, -year > 0 (always).
* These are the minimal limits C places on short.
* Reserving -32768 is useful in the implementation.
This commit is contained in:
Howard Hinnant
2017-08-15 12:42:27 -04:00
parent be871e6c85
commit c3ab69ee0d

4
date.h
View File

@@ -1455,7 +1455,7 @@ inline
year year
year::min() NOEXCEPT year::min() NOEXCEPT
{ {
return year{std::numeric_limits<short>::min()+1}; return year{-32767};
} }
CONSTCD11 CONSTCD11
@@ -1463,7 +1463,7 @@ inline
year year
year::max() NOEXCEPT year::max() NOEXCEPT
{ {
return year{std::numeric_limits<short>::max()}; return year{32767};
} }
CONSTCD11 CONSTCD11