summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-26 22:23:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-27 08:37:42 +0900
commit1fd8b6f2b9b856a7becbda989d3d93f3c795f9a8 (patch)
tree3394de31ea72f751772af6e33cb8c44f5a33726d /time.c
parentb1428b279fe5069f38dae19951dc0a7031422a2b (diff)
Shrink monthly tables
Diffstat (limited to 'time.c')
-rw-r--r--time.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/time.c b/time.c
index 12e5c0d753..a8782ac084 100644
--- a/time.c
+++ b/time.c
@@ -745,7 +745,7 @@ rb_gmtime_r(const time_t *t, struct tm *result)
# define GMTIME(tm, result) rb_gmtime_r((tm), &(result))
#endif
-static const int common_year_yday_offset[] = {
+static const int16_t common_year_yday_offset[] = {
-1,
-1 + 31,
-1 + 31 + 28,
@@ -760,7 +760,7 @@ static const int common_year_yday_offset[] = {
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
/* 1 2 3 4 5 6 7 8 9 10 11 */
};
-static const int leap_year_yday_offset[] = {
+static const int16_t leap_year_yday_offset[] = {
-1,
-1 + 31,
-1 + 31 + 29,
@@ -776,10 +776,10 @@ static const int leap_year_yday_offset[] = {
/* 1 2 3 4 5 6 7 8 9 10 11 */
};
-static const int common_year_days_in_month[] = {
+static const int8_t common_year_days_in_month[] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
-static const int leap_year_days_in_month[] = {
+static const int8_t leap_year_days_in_month[] = {
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
@@ -1107,7 +1107,7 @@ gmtime_with_leapsecond(const time_t *timep, struct tm *result)
result->tm_yday = leap_year_p(result->tm_year + 1900) ? 365 : 364;
}
else if (result->tm_mday == 1) {
- const int *days_in_month = leap_year_p(result->tm_year + 1900) ?
+ const int8_t *days_in_month = leap_year_p(result->tm_year + 1900) ?
leap_year_days_in_month :
common_year_days_in_month;
result->tm_mon--;
@@ -2030,7 +2030,7 @@ vtm_add_offset(struct vtm *vtm, VALUE off, int sign)
vtm->yday = leap_year_v_p(vtm->year) ? 366 : 365;
}
else if (vtm->mday == 1) {
- const int *days_in_month = leap_year_v_p(vtm->year) ?
+ const int8_t *days_in_month = leap_year_v_p(vtm->year) ?
leap_year_days_in_month :
common_year_days_in_month;
vtm->mon--;