mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8283996: Reduce cost of year and month calculations
Reviewed-by: bpb, scolebourne, naoto, rriggs
This commit is contained in:
parent
45d4d7da23
commit
1a5f5da050
2 changed files with 11 additions and 6 deletions
|
@ -363,9 +363,14 @@ public final class LocalDate
|
|||
|
||||
// convert march-based values back to january-based
|
||||
int marchMonth0 = (marchDoy0 * 5 + 2) / 153;
|
||||
int month = (marchMonth0 + 2) % 12 + 1;
|
||||
int month = marchMonth0 + 3;
|
||||
if (month > 12) {
|
||||
month -= 12;
|
||||
}
|
||||
int dom = marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
|
||||
yearEst += marchMonth0 / 10;
|
||||
if (marchDoy0 >= 306) {
|
||||
yearEst++;
|
||||
}
|
||||
|
||||
return new LocalDate((int)yearEst, month, dom);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue