sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 5721deb2c4b5dffa87f9ee481831882eb02dc7c8
parent 5dc02f757bd528e666534cd6492c7c61cdf1a6e4
Author: Willem van de Krol <008054@jfc.nl>
Date:   Fri,  4 Jul 2014 22:00:04 +0200

optimized isleap() function

Diffstat:
Mcal.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/cal.c b/cal.c @@ -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