* Update mask of valid records for a historical data. * @note Call only for the largest history range sub-division. * @param[in,out] valid_history Valid history records. * @param hr History range to update mask for. * @param cur_month Current economy month. */
| 23 | * @param cur_month Current economy month. |
| 24 | */ |
| 25 | void UpdateValidHistory(ValidHistoryMask &valid_history, const HistoryRange &hr, uint cur_month) |
| 26 | { |
| 27 | /* Update for subdivisions first. */ |
| 28 | if (hr.hr != nullptr) UpdateValidHistory(valid_history, *hr.hr, cur_month); |
| 29 | |
| 30 | /* No need to update if our last entry is marked valid. */ |
| 31 | if (HasBit(valid_history, hr.last - 1)) return; |
| 32 | /* Is it the right time for this history range? */ |
| 33 | if (cur_month % hr.total_division != 0) return; |
| 34 | /* Is the previous history range valid yet? */ |
| 35 | if (hr.division != 1 && !HasBit(valid_history, hr.first - hr.division)) return; |
| 36 | |
| 37 | SB(valid_history, hr.first, hr.records, GB(valid_history, hr.first, hr.records) << 1ULL | 1ULL); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Test if history data is valid, without extracting data. |
no test coverage detected