Re: [PATCH v3] libstdc++: Simplify year::is_leap().

2023-11-14 Thread Jonathan Wakely
On Sat, 11 Nov 2023 at 23:00, Cassio Neri wrote: > > The current implementation returns > (_M_y & (__is_multiple_of_100 ? 15 : 3)) == 0; > where __is_multiple_of_100 is calculated using an obfuscated algorithm which > saves one ror instruction when compared to _M_y % 100 == 0 [1]. > > In leap

[PATCH v3] libstdc++: Simplify year::is_leap().

2023-11-11 Thread Cassio Neri
The current implementation returns (_M_y & (__is_multiple_of_100 ? 15 : 3)) == 0; where __is_multiple_of_100 is calculated using an obfuscated algorithm which saves one ror instruction when compared to _M_y % 100 == 0 [1]. In leap years calculation, it's correct to replace the divisibility