lunarToSolar static method
Implementation
static Solar lunarToSolar(Lunar lunar) {
int days = _lunarMonthDays[lunar.lunarYear - _lunarMonthDays[0]];
int leap = _getBitInt(days, 4, 13);
int offset = 0;
int loopEnd = leap;
if (!lunar.isLeap) {
if (lunar.lunarMonth <= leap || leap == 0) {
loopEnd = lunar.lunarMonth - 1;
} else {
loopEnd = lunar.lunarMonth;
}
}
for (int i = 0; i < loopEnd; i++) {
offset += (_getBitInt(days, 1, 12 - i) == 1 ? 30 : 29);
}
offset += lunar.lunarDay;
int solar11 = _solar_1_1[lunar.lunarYear - _solar_1_1[0]];
int y = _getBitInt(solar11, 12, 9);
int m = _getBitInt(solar11, 4, 5);
int d = _getBitInt(solar11, 5, 0);
return _solarFromInt(_solarToInt(y, m, d) + offset - 1);
}