[libxslt] Optimize IS_LEAP
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Optimize IS_LEAP
- Date: Thu, 18 May 2017 16:24:50 +0000 (UTC)
commit a2b3d47b3a3215d43149f5d8ab34ebfdecf37b5e
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed May 17 21:47:57 2017 +0200
Optimize IS_LEAP
See http://stackoverflow.com/a/11595914
libexslt/date.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libexslt/date.c b/libexslt/date.c
index 3af6f7f..625dea6 100644
--- a/libexslt/date.c
+++ b/libexslt/date.c
@@ -148,7 +148,7 @@ struct _exsltDateVal {
#define VALID_SEC(sec) ((sec >= 0) && (sec < 60))
#define VALID_TZO(tzo) ((tzo > -1440) && (tzo < 1440))
#define IS_LEAP(y) \
- (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
+ (((y & 3) == 0) && ((y % 25 != 0) || ((y & 15) == 0)))
static const unsigned long daysInMonth[12] =
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]