optimized isleap() function

This commit is contained in:
Willem van de Krol 2014-07-04 22:00:04 +02:00 committed by sin
parent 5dc02f757b
commit 5721deb2c4
1 changed files with 4 additions and 8 deletions

12
cal.c
View File

@ -93,15 +93,11 @@ dayofweek(int year, int month, int day, int fday)
static bool
isleap(int year)
{
bool leap = false;
if(year % 4 == 0)
leap = true;
if(year % 100 == 0)
leap = false;
if(year % 400 == 0)
leap = true;
return leap;
return true;
if(year % 100 == 0)
return false;
return (year % 4 == 0);
}
static void