mirror of
https://github.com/holub/mame
synced 2025-06-30 07:58:56 +03:00
Simplified coreutil.c gregorian_days_in_month. [William Krick]
This commit is contained in:
parent
0bb208ce12
commit
377168c4b4
@ -82,12 +82,11 @@ int gregorian_is_leap_year(int year)
|
||||
|
||||
int gregorian_days_in_month(int month, int year)
|
||||
{
|
||||
if (month == 2)
|
||||
return gregorian_is_leap_year(year) ? 29 : 28;
|
||||
else if (month == 4 || month == 6 || month == 9 || month == 11)
|
||||
return 30;
|
||||
else
|
||||
return 31;
|
||||
assert(month >= 1 && month <= 12)
|
||||
|
||||
int days[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
||||
days[1] += gregorian_is_leap_year(year) ? 1 : 0;
|
||||
return days[month-1];
|
||||
}
|
||||
|
||||
|
||||
@ -121,4 +120,4 @@ void rand_memory(void *memory, size_t length)
|
||||
UINT32 core_crc32(UINT32 crc, const UINT8 *buf, UINT32 len)
|
||||
{
|
||||
return crc32(crc, buf, len);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user