Optimizations

git-svn-id: svn://svn.cc65.org/cc65/trunk@2642 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-11 22:33:42 +00:00
parent 1e624c5e91
commit 94e041264e

View File

@@ -67,7 +67,7 @@ static const unsigned MonthDays [] = {
static unsigned char IsLeapYear (int Year) static unsigned char __fastcall__ IsLeapYear (unsigned Year)
/* Returns 1 if the given year is a leap year */ /* Returns 1 if the given year is a leap year */
{ {
return (((Year % 4) == 0) && ((Year % 100) != 0 || (Year % 400) == 0)); return (((Year % 4) == 0) && ((Year % 100) != 0 || (Year % 400) == 0));
@@ -75,13 +75,13 @@ static unsigned char IsLeapYear (int Year)
time_t __fastcall__ mktime (struct tm* TM) time_t __fastcall__ mktime (register struct tm* TM)
/* Make a time in seconds since 1/1/1970 from the broken down time in TM. /* Make a time in seconds since 1/1/1970 from the broken down time in TM.
* A call to mktime does also correct the time in TM to contain correct * A call to mktime does also correct the time in TM to contain correct
* values. * values.
*/ */
{ {
div_t D; register div_t D;
int Max; int Max;
unsigned DayCount; unsigned DayCount;
@@ -167,7 +167,7 @@ time_t __fastcall__ mktime (struct tm* TM)
* (and the last leap year before 1970 was 1968) * (and the last leap year before 1970 was 1968)
*/ */
DayCount = ((unsigned) (TM->tm_year-70)) * 365U + DayCount = ((unsigned) (TM->tm_year-70)) * 365U +
(((unsigned) (TM->tm_year-68-1)) / 4) + (((unsigned) (TM->tm_year-(68+1))) / 4) +
TM->tm_yday; TM->tm_yday;
/* Calculate the weekday */ /* Calculate the weekday */