optimized isleap() function
This commit is contained in:
parent
5dc02f757b
commit
5721deb2c4
12
cal.c
12
cal.c
|
@ -93,15 +93,11 @@ dayofweek(int year, int month, int day, int fday)
|
||||||
static bool
|
static bool
|
||||||
isleap(int year)
|
isleap(int year)
|
||||||
{
|
{
|
||||||
bool leap = false;
|
|
||||||
|
|
||||||
if(year % 4 == 0)
|
|
||||||
leap = true;
|
|
||||||
if(year % 100 == 0)
|
|
||||||
leap = false;
|
|
||||||
if(year % 400 == 0)
|
if(year % 400 == 0)
|
||||||
leap = true;
|
return true;
|
||||||
return leap;
|
if(year % 100 == 0)
|
||||||
|
return false;
|
||||||
|
return (year % 4 == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user