[前][次][番号順一覧][スレッド一覧]

ruby-changes:66609

From: Nobuyoshi <ko1@a...>
Date: Sun, 27 Jun 2021 08:54:06 +0900 (JST)
Subject: [ruby-changes:66609] 1fd8b6f2b9 (master): Shrink monthly tables

https://git.ruby-lang.org/ruby.git/commit/?id=1fd8b6f2b9

From 1fd8b6f2b9b856a7becbda989d3d93f3c795f9a8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 26 Jun 2021 22:23:54 +0900
Subject: Shrink monthly tables

---
 time.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/time.c b/time.c
index 12e5c0d..a8782ac 100644
--- a/time.c
+++ b/time.c
@@ -745,7 +745,7 @@ rb_gmtime_r(const time_t *t, struct tm *result) https://github.com/ruby/ruby/blob/trunk/time.c#L745
 #   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[] = { https://github.com/ruby/ruby/blob/trunk/time.c#L760
     -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[] = { https://github.com/ruby/ruby/blob/trunk/time.c#L776
       /* 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) https://github.com/ruby/ruby/blob/trunk/time.c#L1107
                 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) https://github.com/ruby/ruby/blob/trunk/time.c#L2030
                 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--;
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]