Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 14:19 +, Jonathan Wakely wrote: On 25/02/21 14:02 +, Jonathan Wakely wrote: On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto _

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 14:02 +, Jonathan Wakely wrote: On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto __r0 = static_cast(__dp.count()) + __r2_e3; The a

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto __r0 = static_cast(__dp.count()) + __r2_e3; The above would be a better fix. Indeed, __r0 belongs

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Cassio Neri via Gcc-patches
Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto __r0 = static_cast(__dp.count()) + __r2_e3; The above would be a better fix. Indeed, __r0 belongs to [0, 2^32[ which allows all arithmetics that follow to be

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 17:28 +, Jonathan Wakely wrote: On 23/02/21 13:24 +, Cassio Neri via Libstdc++ wrote: This patch reimplements std::chrono::year_month_day::_S_from_days() which retrieves a date from the number of elapsed days since 1970/01/01. The new implementation is based on Proposition 6

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 13:24 +, Cassio Neri via Libstdc++ wrote: This patch reimplements std::chrono::year_month_day::_S_from_days() which retrieves a date from the number of elapsed days since 1970/01/01. The new implementation is based on Proposition 6.3 of Neri and Schneider, "Euclidean Affine Funct

[PATCH 1/4] libstdc++: More efficient date from days.

2021-02-23 Thread Cassio Neri via Gcc-patches
This patch reimplements std::chrono::year_month_day::_S_from_days() which retrieves a date from the number of elapsed days since 1970/01/01. The new implementation is based on Proposition 6.3 of Neri and Schneider, "Euclidean Affine Functions and Applications to Calendar Algorithms" available at h