Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16 [v2]

2023-11-05 Thread Cassio Neri
On Sun, 5 Nov 2023 22:14:50 GMT, Claes Redestad wrote: >> Thanks for your interest in my work. I'd love to assist porting our >> algorithms to Java. Notice, however, that I'm not a Java programmer and I >> don't have the complete picture of what goes on in the JVM. What follows is >> based on

Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16 [v2]

2023-11-04 Thread Cassio Neri
On Fri, 3 Nov 2023 23:22:27 GMT, Claes Redestad wrote: >> https://github.com/cassioneri/eaf suggest this code for leap year >> calculation: >> >> public static boolean isLeap(long year) { >> int d = year % 100 != 0 ? 4 : 16; >> return (year & (d - 1)) == 0; >> } >> >> .

Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16 [v2]

2023-11-04 Thread Cassio Neri
On Sat, 4 Nov 2023 16:01:44 GMT, Claes Redestad wrote: >> src/java.base/share/classes/java/time/Year.java line 321: >> >>> 319: // So for a year that's divisible by 4, checking that it's >>> also divisible by 16 >>> 320: // is sufficient to determine it must be a leap year. >>>

Re: RFR: 8319423: Improve Year.isLeap by checking divisibility by 16 [v2]

2023-11-04 Thread Cassio Neri
On Fri, 3 Nov 2023 23:22:27 GMT, Claes Redestad wrote: >> https://github.com/cassioneri/eaf suggest this code for leap year >> calculation: >> >> public static boolean isLeap(long year) { >> int d = year % 100 != 0 ? 4 : 16; >> return (year & (d - 1)) == 0; >> } >> >> .