Small size optimization.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@410 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-08-03 02:39:20 +00:00
parent 31661b437d
commit c874cbfbbd
1 changed files with 7 additions and 8 deletions

View File

@ -122,9 +122,8 @@ WORD ASMCFUNC FAR clk_driver(rqptr rp)
case C_OUTPUT: case C_OUTPUT:
{ {
int c;
const unsigned short *pdays; const unsigned short *pdays;
unsigned Month, Day, Year; unsigned Day, Month, Year;
struct ClockRecord clk; struct ClockRecord clk;
ticks_t hs, Ticks; ticks_t hs, Ticks;
@ -146,25 +145,25 @@ WORD ASMCFUNC FAR clk_driver(rqptr rp)
/* Now set AT clock */ /* Now set AT clock */
/* Fix year by looping through each year, subtracting */ /* Fix year by looping through each year, subtracting */
/* the appropriate number of days for that year. */ /* the appropriate number of days for that year. */
for (Year = 1980, c = clk.clkDays;;) for (Year = 1980, Day = clk.clkDays;;)
{ {
pdays = is_leap_year_monthdays(Year); pdays = is_leap_year_monthdays(Year);
if (c >= pdays[12]) if (Day >= pdays[12])
{ {
++Year; ++Year;
c -= pdays[12]; Day -= pdays[12];
} }
else else
break; break;
} }
/* c contains the days left and count the number of */ /* Day contains the days left and count the number of */
/* days for that year. Use this to index the table. */ /* days for that year. Use this to index the table. */
for (Month = 1; Month < 13; ++Month) for (Month = 1; Month < 13; ++Month)
{ {
if (pdays[Month] > c) if (pdays[Month] > Day)
{ {
Day = c - pdays[Month - 1] + 1; Day -= pdays[Month - 1] + 1;
break; break;
} }
} }