Merge pull request #8332 from Morph1984/reduce_exec_size

general: Use smaller array types where applicable
This commit is contained in:
bunnei 2022-05-29 02:33:24 -07:00 committed by GitHub
commit 1c8b509441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 19 deletions

View file

@ -110,10 +110,9 @@ static constexpr s64 GetLeapDaysFromYear(s64 year) {
}
}
static constexpr int GetMonthLength(bool is_leap_year, int month) {
constexpr std::array<int, 12> month_lengths{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
constexpr std::array<int, 12> month_lengths_leap{31, 29, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
static constexpr s8 GetMonthLength(bool is_leap_year, int month) {
constexpr std::array<s8, 12> month_lengths{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
constexpr std::array<s8, 12> month_lengths_leap{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
return is_leap_year ? month_lengths_leap[month] : month_lengths[month];
}