[PATCH] libstdc++: More efficient std::chrono::year::leap.

Koning, Paul Paul.Koning@dell.com
Fri May 21 18:05:14 GMT 2021



> On May 21, 2021, at 1:46 PM, Cassio Neri via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> Simple change to std::chrono::year::is_leap. If a year is multiple of 100,
> then it's divisible by 400 if and only if it's divisible by 16. The latter
> allows for better code generation.

I wonder if the optimizer could be taught to do that.

The change seems correct but it is very confusing; at the very least the reasoning you gave should be stated in a comment on that check.

	paul




More information about the Libstdc++ mailing list